Hmm, interesting. So could I just take the minified .js blob that Meteor puts out, and run it through Prepack, and it’ll improve performance somewhat?
This will improve performance even further. According to the docs:
I think @sashko should look into this. Maybe integration with Meteor core…
Oh, that looks very interesting, the examples on their website are really cool! I suspect the end result might be less than the examples show though, as V8 is pretty smart and probably already does a lot of these optimizations at runtime. However, doing them at compile time would be better of course, and there might be some stuff that V8 doesn’t do.
You’re right! V8 is smart already. Facebook takes things further in their implementations of ‘popular’ tools. Though Prepack isn’t ready for production use right now, it has several plugins already for VScode, Webpack that I want to try out on Meteor to see what performance gains it actually brings to my existing apps. https://prepack.io/getting-started.html
Hmm, I tried running it on my client blob.
First it gave the error
__meteor_runtime_config__ is not defined
I fixed that by copying the
__meteor_runtime_config__ inline script that is in the HTML of my site and pasting it at the top.
Now it gives this cryptic error instead:
not an object TypeError at client.js:4:5255 at call (native) at client.js:4:4727 at client.js:4:2
Does anyone have actual benchmarks of anything yet?
You’re running into this: https://github.com/facebook/prepack/issues/538
We made need to wait for this: https://github.com/facebook/prepack/issues/24
If you come up with a solution in the meantime, let me know
But I thought it said “using environment browser” or something when it ran. Will check again…
According to the section The Environment matters! of https://prepack.io/,
Prepack has no built-in knowledge of document or window. In fact, when prepacking code which references such properties, they will evaluate to undefined.
But it says here that it uses the “browser” built-in environment by default. I also now tried with --compatibility “browser”, and it gave me the same error
Edit: Ah, I checked at 4:5255 now, and it’s this function:
So it is indeed document that is causing trouble, even though they seem to say in the options spec that they’ve fixed that
Would be nice if there was some way to just say “ignore optimizing anything that references this object”.
When is Prepack ready to be used in production?
Wait for our latest release to reach v1.0.
I think it’s not ready for integration but I’m curious what performance benefits we can get from using it in a real life application.
@mitar You think this could make blaze great again without turning to virtual dom?
Prepack is gonna be in alpha for a while, definitely not ready for production, unfortunately. Currently, it’s only at v0.2.2.
Perhaps we could put together an Atmosphere package (yes, those still exist) integrating it into the Meteor build process, to at least have people start playing around with it in development.