5 ms·
JS is very fast these days on all the modern browsers including ie9. There is plenty you could do. However if you really want speed I wonder if you could brid
by eagsalazar 14y ago
JS is very fast these days on all the modern browsers including ie9. There is plenty you could do.
However if you really want speed I wonder if you could bridge access to certain useful functions by delegating access to, for example, sandboxedAnimate = function (sel, attr, duration, easing) {} in a closure. If you want to allow plugins on your site for example, 200X for basic stuff and full speed for jquery animations, etc would be more than enough 99.9% of the time.
Also if you use CSS animations where there would be zero slowdown. So make that plenty fast 99.99% of the time.
- eagsalazar 14y agoYeah, providing sandboxed and controlled access to certain areas of the dom and certain functions is exactly what they appear to be doing in their TW example. However, that tiny demo looks like it takes up 800 lines of code! WTF?
- jterrace 14y agoYeah, I'm in no way proud of that beast of a code. There are a couple things at play here: 1. The js.js API is currently very low-level, which makes it verbose and difficult to use. There's a lot of room for improvement. 2. The twitter script was actually chosen because it's complex. It has a ton of boilerplate code that you'd probably be surprised is in there. 3. A lot of the code written could be generalized into a generic virtual DOM interface library that is not specific to this twitter script. Things like screen.width and screen.height are common properties that would be accessed by many different scripts and so could be generalized.
- eagsalazar 14y agoSomething like this would be awesome: var env = {local1: function (){}, local2: "blah"}; js = new JSJS(env); js.eval("console.log('I am evil!'); local1();");