Hacker News new | ask | show | jobs
How to go faster than jQuery, Ext, Mootools...?
40 points by jie 5556 days ago
http://myjs.fr

I coded a JS framework that goes faster than jQuery, Ext, Mootools... (I haven't find any faster on the web for now) Accessing and modifying HTML Element properties are the main taks of JS frameworks and My.js does those operations way faster than others. My.js also handles custom classes more efficiently. See the tests.

I presented the framework and the core concepts I used to build it to the Paris JS communauty yesterday (parisjs.org). Paris JS Hackers gave me real nice feedbacks, comments and tweets.

I would love to have feedback from Hacker news hackers too!

14 comments

Work on the site's design! For a JS framework to succeed, I think it has to have a beautiful site. I'm guessing designers are one of your biggest audiences.

Also, the site doesn't work with the StumbleUpon plugin for Chrome.

Hehe, Myjs.fr is simply not designed! I presented the framework yesterday to a JS conf, many people wanted to try it out fast. So I pushed a raw version of the framework in the rush today. I'll be adding a getting started page, more benchmarks and the api doc first and i'll go for the Design quickly. For StumbleUpon, I don't know why it's not working, myjs.fr is a simple static site, with some .css & .js. By the way, do you happen to know good designers/developers? (I'm looking for a great one for my startup)
If you want to toss this site's repo up on Github (or email me directly if you wish to keep it private), I'll design it. No obligation to use my design but I'm going under the assumption that this is a non-commercial project & the design would be attributed to me if used.
Right, my.js is no commercial project. I'm pushing it on Github soon. It would be pretty cool if you could help on the design. If you make something that looks nice for my.js, I'll push it online and all design credits goes to you of course! Myjs.fr has been tweeted and visited a lot since yesterday! @jie
Two suggestions:

- Get this on GitHub

- Get a native english speaker/writer to fix up the copy

I'm pushing it on Github and I'm also coming to the States before Summer. Sure, I'll find nice people to help me fix up the copy!
What's the link for my.js on Github?
The work behind is impressive and inovative.

More general benchmarks would be nice. more real life situations maybe, even if it is hard to say what is 'real life'.

or simply to fork http://mootools.net/slickspeed/ and to put myjs in there to see how it compares.

Totally right. I intend to add much more benchmarks and concrete examples in days to come. At first, I wanted to use Slickspeed but Slickspeed is very much "selectors" oriented. It was useful to have those selectors tests 3 years ago when each framework had to implement its own selector methods. But today, no matter which framework, under the hood it's the same "querySelectorAll" method. So comparing frameworks according to their selectors like slickspeed is a bit like comparing the performances of 2 PCs with the same hardware. In fact, the real difference between JS frameworks comes from the way they handle their HTMLElement wrappers, how those are created, how fast they access and modify the DOM. Keep you updated on the benchmarks!
Hi!

I had to leave earlier ParisJS, so I haven't seen your presentation, but people have given me some nice feedbacks! I like the way you take care of performance, it's cool!

But... I'm not sure that caching your result is a good idea. Almost by definition, Javascript is changing the DOM, so are the results eventually. A good practice is to cache-it, but manually is good enough, and at least you keep the power on the lists. I mention this because this is the feature you've highlighted with your benchmark.

Here an explanation of my words :

scope.ready(function(my, $) {

$("h2").addClass("mytest");

$("div").appendHtml("<h2>Test</h2>");

$("h2").addClass("mytest2");

});

>>> My new h2 doesn't have any class.

I'm looking forward to see how this will evolve! Keep going!

In my.js, elts wrappers are both cached by id and in their native HTMLElements. The performance increases are sometimes from 1 to 100. Caching FTW. In fact, caching has only 1 minor fallback: you can't change an elt id if you have already accessed it by his former id (but who does? it's such bad practice). For the above snippet, it's normal that your new h2 doesn't have any class since the $ fn only returns the first h2 (like querySelector) contrary to jQuery $ who returns a set. The 3rd line of your code only add class to your first h2. To get a set of selected elts in my.js, use "$.elts" and it will work! If you're interested, I may give a presentation on my.js at the next WebWorkerCamp in Paris!
First, I would recommend you to update the website design :) It lacks color (and backgrounds!) in Firefox and it needs an horizontal scrollbar on my 24" screen :|

Concerning the framework, I must admit that I'm quite impressed. It's clearly different from current mainstream framework, particularly due to your use of aggressive inlining. It may not me the best bet for all use case, but it's definitely worth a look.

Thx! I'll do something about the site this week end, check it out when the docs are online, I'll tweet it!
Really nice framework ! I'll try it in a future project.

Am I the only one who can't browse the documentation on myjs.fr ? on any browser on Linux.

Also, check this awesome speed benchmark ! http://jsperf.com/my-js-perf-tests/4

Thx! Sorry for the docs, my.js index on the left can't be browsed. I'll put a doc online this WE! For the perfs, I didn't imagine such a gap with others framework! I'll try to integrate my.js in taskspeed soon!
I, for one, would like some of these micro-optimizations to make their way into the mainstream frameworks ; I don't see my.js getting big in the current state of things but merged into jQuery, it could really help us all :)
MICRO-optimizations? Check some perfs: http://jsperf.com/my-js-perf-tests! There is still much to do for my.js to become mainstream. I may write a plugin for jQuery but for the moment I want to let my.js grow and stay independent. I think that my.js bring new concepts on the table that can't integrate in the main other frameworks without changing their core.
I haven't looked at the source, but I really like your idea of dynamically generating code for speed. Good work!

I'll be sure to check it out next time I work on something personal that isn't already jQuery centric. :-)

Thx! Yes, a good JS framework is not only about performance but also about the number of plugins, the good doc and its users base... And I have to admit, jQuery is good on those points! Give my.js some time, it's gonna grow!
A tiny jsperf to illustrate the utility of the scope function: http://jsperf.com/my-js-scope-performances
I was at ParisJS during your presentation. From what I saw it really looks promising. I have yet to try it but it seems like a great stuff. Good work though.
Thx! See you next month at ParisJS!
Uh! I forgot about ParisJS. :P
Put it on Git ! Very fast framework, you should build a more comprehensive demo page.
Clickable: http://myjs.fr
Thanks, very useful. I gonna try it in my next dev.
maybe I'm not getting something, but.. isn't it obvious that you can trade versatility and ease of use for speed?