jQuery too slow ?

jQuery is great JavaScript library, only that in time the core code has changed too heavy and most of the functionality is not used. Also jQuery has great support for cross browser functions, which need additional checks and boilerplate. This all slows down performance and may not be suitable for the mobiles.

What could be alternatives is to use some of the lightweight versions of jQuery like zepto.js, snack.js etc. Well even if these libraries seems to be too heavy, the last thing is to use JavaScript without any library or create your own layer top of the functions you need.

I did some of the performance test with jQuery, Zepto.js and using pure JavaScript DOM. All of the tests are done with , which runs the testing code in loop and counts the operations per second. ALl the benchmark tests are pushed to Github.

Example code of the JSlitmus test:

/*
 * Simple DOM object creation without adding to html.
 */
JSLitmus.test('DOM element creation', function() {
  document.createElement('div');
});


As you can see the winner of benchmark is JavaScript DOM API, also if the development is clearly mobile platform you should take advantage from lighter libraries.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s