Earlier quoted context omitted.
In this particular case, I believe there are 3 reasons: 1) Size - turning each op into a couple of bytes means that the size of your template is significantly smaller. If each instruction is 4 bytes, I could get ~20 instructions in the space of just one function with a setAttribute call: function t(e) {e.setAttribute("id", "bar")} Size is much more important on the web than it is in other places especially as the nex…
For 1) and 2), some frameworks solve the size issue by creating functions for the basic DOM ops, which then get minimized to single character names in production. So in your example, there might be a setNodeAttribute(node, name, val) function, such that the final code isn't `e.setAttribute("id", "bar")` but just `a(e,"id","bar")`, where `a` is the minimized name of setNodeAttribute. There's really not much noise in t…
The Glimmer VM: Boots Fast and Stays Fast
41–50 of 92 posts
Re: The Glimmer VM: Boots Fast and Stays Fast
#42Earlier quoted context omitted.
For 1) and 2), some frameworks solve the size issue by creating functions for the basic DOM ops, which then get minimized to single character names in production. So in your example, there might be a setNodeAttribute(node, name, val) function, such that the final code isn't `e.setAttribute("id", "bar")` but just `a(e,"id","bar")`, where `a` is the minimized name of setNodeAttribute. There's really not much noise in t…
Well, Glimmer actually compiles opcodes to just numbers. So it wouldn't be `a(e,"id","bar")`, it's actually [1,'id','bar']. Opcodes' wire format is an array. I haven't see it being a tree yet. If this is the case, stream parsing is definitely possible.
Compared to the string encoding above we went from 14 chars (1-4 bytes each, we'll just say 2) at 28 bytes to 4 bytes for our 32 bit int.
Re: The Glimmer VM: Boots Fast and Stays Fast
#43Isn't this just re-solving a decades old problem, with the (unnecessary) constraints caused by modern web systems?
Re: The Glimmer VM: Boots Fast and Stays Fast
#44What IS the glimmer VM? I didn't see any links on the page. Is this it? https://github.com/glimmerjs/glimmer-vm It is JavaScript code or native code?
Re: The Glimmer VM: Boots Fast and Stays Fast
#45https://medium.com/@bluepnume/introducing-support-for-cross-...
I'd love it if it were a little more flexible to get started with though. Rather than fire up ember-cli, I'd love to just be able to:
1. Load glimmer.js from a CDN
2. Extend glimmer.Component
3. Render my component into an element
I know ember-cli solves this problem for a lot of users, but I'd love for the number of steps to get a "hello world" working to be as simple as the above. I think that's one of the reasons React has been so successful: it's stupid-simple to get started with, and it draws you in from there.
Re: The Glimmer VM: Boots Fast and Stays Fast
#46Re: The Glimmer VM: Boots Fast and Stays Fast
#47Earlier quoted context omitted.
In this particular case, I believe there are 3 reasons: 1) Size - turning each op into a couple of bytes means that the size of your template is significantly smaller. If each instruction is 4 bytes, I could get ~20 instructions in the space of just one function with a setAttribute call: function t(e) {e.setAttribute("id", "bar")} Size is much more important on the web than it is in other places especially as the nex…
For 1) and 2), some frameworks solve the size issue by creating functions for the basic DOM ops, which then get minimized to single character names in production. So in your example, there might be a setNodeAttribute(node, name, val) function, such that the final code isn't `e.setAttribute("id", "bar")` but just `a(e,"id","bar")`, where `a` is the minimized name of setNodeAttribute. There's really not much noise in t…
> they're already fast enough that most of the time is spent in rendering, not in javascript DOM manipulation
That hasn't been my experience, but it's been awhile since I've benchmarked any of the frameworks in common use. Change tracking, diffing, and then the dom calls have all been the bulk of the work in large updates. Assuming you're doing those in a dom fragment I'm not sure how "rendering time" (I'm taking that to mean compositing and painting?) could be the bottleneck in that scenario.
Re: The Glimmer VM: Boots Fast and Stays Fast
#48I'm a big fan of what I'm seeing in Glimmer so far. I had fun adding support for xcomoponent yesterday, making Glimmer components work as cross-domain components. https://medium.com/@bluepnume/introducing-support-for-cross-... I'd love it if it were a little more flexible to get started with though. Rather than fire up ember-cli, I'd love to just be able to: 1. Load glimmer.js from a CDN 2. Extend glimmer.Component 3…
Re: The Glimmer VM: Boots Fast and Stays Fast
#49What IS the glimmer VM? I didn't see any links on the page. Is this it? https://github.com/glimmerjs/glimmer-vm It is JavaScript code or native code?
https://www.youtube.com/playlist?list=PLpAr6J-75N24C-XQgIUDM...
Re: The Glimmer VM: Boots Fast and Stays Fast
#50Isn't this just re-solving a decades old problem, with the (unnecessary) constraints caused by modern web systems?
While being technically correct, your statement is pretty much pointless. All development is 'just' re-solving an existing problem with better performance, or 'just' extending an existing algorithm to be more resilient, or 'just' implementing a legacy interface on a new platform. There are lots of very obvious reasons that the web has the constraints that it does and describing them as 'unnecessary' adds literally no…