4 ms·
One way to see it's more subtle than meets the eye: suppose the website defines a function F which is annotated as taking a string argument. The website itself
by xamuel 7y ago
One way to see it's more subtle than meets the eye: suppose the website defines a function F which is annotated as taking a string argument. The website itself only ever calls F with strings. But suppose I go to the website, open the console, and punch in F(1). Of course, this sort of thing could be guarded against, but the point is just that it would introduce more complexity than initially meets the eye.
- dymk 7y agoEngines already have to do this - check the type of an argument before calling the compiled version of the function. What the OP is suggesting is simply prefilling the type and instruction caches with information that the build system was already able to gleen.
- _bxg1 7y agoAnd that would probably amount to a "bailout". I'm only talking about providing hints that can be used to skip parts of the described process, not getting rid of it altogether.
- leeoniya 7y agoi always wondered why it wasn't possible to use a js app in "record" mode and then export any witnessed type & profiling information from the JIT and deliver it alongside the source (like a sourcemap).
- antiuniverse 7y agoThat might be considered an example of profile-guided optimization: https://en.wikipedia.org/wiki/Profile-guided_optimization https://en.wikipedia.org/wiki/Profile-guided_optimization
- leeoniya 7y agoyes, i was going to say PGO :)