Comments (13)
we use it for flushing/streaming content
from bem-xjst.
@veged: I know, but this is now what I meant. Current 2.x implementation does this stuff in a following way:
block('b1').def()(function() {
return '<div>' + applyNext() + '</div>';
});
Strictly speaking, this is much more clear than (old i-bem):
block('b1').def()(function() {
this._str += '<div>';
applyNext();
this._str += '</div>';
});
I would prefer first style, and it is not that big pain to switch over to it. So the question is can we afford this?
from bem-xjst.
but what we gonna do with apply*
cals? not all of .def()
templates returning value, some redefines just call applyNext
from bem-xjst.
Why not require them to return a value now?
from bem-xjst.
we need to do like that:
block('b1').def()(function() {
return applyNext({ '_bla': 1 });
});
but right now we do just:
block('b1').def()(function() {
applyNext({ '_bla': 1 });
});
from bem-xjst.
Yes, exactly. Can we change this, and/or ask people to change it? Seriously, the internal implementation will be much simpler this way (and probably faster).
from bem-xjst.
ok — let's suppose we can do this in v2
from bem-xjst.
great! :)
from bem-xjst.
THIS IS REQUIRED FOR FLUSHING/STREAMING
Could be possibly skipped in case where we don't need to flush/stream things. So templates should use return
with applyCtx()
anyway.
from bem-xjst.
Proposed implementation is here: 51dee47 . No performance regression without _flush
, and with it.
from bem-xjst.
Looks like it isn't done:
block(‘b1’).def()(function() { return ‘#’ + applyNext(); })
from bem-xjst.
Test case fixed in 678e33e. However a bigger question remains.
Particularly, block page
overrides def()
mode, making this _flush
feature useless.
Second question is speed: current implementation of _flush
slows things by 2-5% with disabled flush
. If there won't be resolution for the block page
- we should consider removing this feature on initial release.
from bem-xjst.
And this is done in:
compile:basic:next x 1,919 ops/sec ±1.09% (558 runs sampled)
compile:basic:prev x 1,937 ops/sec ±1.19% (562 runs sampled)
render:basic:next x 770,381 ops/sec ±0.23% (592 runs sampled)
render:basic:prev x 820,049 ops/sec ±0.20% (592 runs sampled)
flush:basic:next x 703,103 ops/sec ±0.24% (591 runs sampled)
flush:basic:prev x 832,992 ops/sec ±0.17% (593 runs sampled)
compile:islands:next x 608 ops/sec ±0.95% (558 runs sampled)
compile:islands:prev x 617 ops/sec ±0.90% (556 runs sampled)
render:islands:next x 1,415 ops/sec ±0.26% (588 runs sampled)
render:islands:prev x 1,462 ops/sec ±0.16% (588 runs sampled)
flush:islands:next x 1,445 ops/sec ±0.23% (588 runs sampled)
flush:islands:prev x 1,448 ops/sec ±0.20% (586 runs sampled)
compile:showcase:next x 587 ops/sec ±0.96% (558 runs sampled)
compile:showcase:prev x 596 ops/sec ±0.93% (556 runs sampled)
render:showcase:next x 2,633 ops/sec ±0.29% (586 runs sampled)
render:showcase:prev x 2,592 ops/sec ±0.29% (587 runs sampled)
flush:showcase:next x 2,305 ops/sec ±0.57% (579 runs sampled)
flush:showcase:prev x 2,469 ops/sec ±0.27% (589 runs sampled)
Doesn't look like significant regression in _flush
. I guess it should be fine to release 2.x with this feature ;)
from bem-xjst.
Related Issues (20)
- runtime-lint/index.js not found HOT 2
- Incorrect linter "someone changed ctx.mods" HOT 2
- Update bem-xjst in online demo
- Очередность применения шаблонов для элемента при указании `block('*').elem('*')` HOT 4
- Производительность движка в некоторых случаях можно увеличить HOT 5
- docs: Wrong default value for exportName in `3-api.md` HOT 2
- [online demo] Migrate from URL Shortener APIs to Firebase Dynamic Links (FDL) HOT 1
- bem-xjst 7.7.6-7.7.7. Увеличен размер бандла bemtree и bemhtml на клиенте
- Docs: insure all add* modes are present in docs
- attrescape: should escape `<` and `>` HOT 1
- Tree Shaking for templates (like CSSO for bem-xjst)
- attrescape: Do not escape & HOT 3
- Prevent multiple calls of add* methods on the same node
- Question about difference with 7.x behaviour
- Benchmarks: missing dependencies, broken link in documentation HOT 3
- Nested mixes are duplicated
- Nested mixes as BEMJSON are not processed HOT 1
- Nested mixes work wrong with strings HOT 1
- Не работает BEM-XJST Demo
- How to compile css style rules with component/block etc.?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bem-xjst.