psiho / jsbench-me

jsbench.me - JavaScript performance benchmarking playground
140 stars 2 forks source link

Support for older browsers #73

Open aaferrari opened 5 months ago

aaferrari commented 5 months ago

By old browsers I mean those that are compatible with ECMAScript 5 (perhaps also adding some of the polyfills mentioned at https://www.kriasoft.com/universal-router/#browser-support ).

The idea came to me when I wanted to test the performance of the same code in two versions of Pale Moon (one old and one more current), so I imagine that there could be more people interested in doing something similar but with other browsers.

To achieve this I deminified and transpiled the original code with BabelJS along with some later modifications I was doing so that it could work well in Pale Moon 27 (I had to convert it into a Greasemonkey/Tampermonkey userscript because of the additional code that runs in the sandbox).

In fact, I managed to get it working without any major hiccups, except for these problems that I couldn't solve:

Upon further review I noticed that the page does not use a real textarea but rather one emulated with HTML and Javascript, so maybe both problems could be solved by changing it to something like https://github.com/adriancs2/Textarea-Syntax-Highlight (which uses a textarea with a tag code behind it that is updated on the fly) which in turn would perhaps resolve the bugs reported in #48 and #72.

Another option as a code editor could be Ace, which is used in sites like OnlineGDB and seems easy to implement.

Finally, this is the userscript I was doing: jsbench.me_for_old_browsers.user.js.txt