3 ms·
I don't think that it is possible to replace JS with a nice IL in near future due to the momentum it gathered all these years. However, is it possible to sugges
by liuliu 16y ago
I don't think that it is possible to replace JS with a nice IL in near future due to the momentum it gathered all these years. However, is it possible to suggest a strict subset of JS that is easier for interpreter to optimize on? If that can be done, I am happy to write code with less flexibility but can run thousands faster.
- evanrmurphy 16y agoNeat idea. Which subset of the language could be better optimized by interpreters?
- roel_v 16y agoSubset is hard to define I think, it seems that would have many repercussions. I like JoachimSchipper's suggestion above, that adds a construct in which the programmer promises not to do any funny stuff to certain variables so that the optimizer can go to town on the optimization on them.
- sid0 16y agoSo like ECMAScript 5 strict mode?
- roel_v 16y agoLooks something like it, I didn't know about it. I don't know if it will protect against the things that are mentioned in the article though, the descriptions that I've (admittedly only cursory) read don't say that the things that mentioned in the article aren't allowed anymore under strict mode (like the Object.prototype.valueOf = function() example given). Maybe it is, in which case this would be great it seems. Not that I have intimate knowledge of it, but still ;)