Magento Forum

   
Page 1 of 2
ditch prototype use jquery
 
JJ Pagac
Member
 
Avatar
Total Posts:  52
Joined:  2007-12-06
Madison, WI USA
 

I like most have started out with scriptaculous/prototype to later run into jquery.  Jquery is much leaner, and really worth looking into.  Just an idea.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kameko.rouge
Member
 
Total Posts:  58
Joined:  2007-10-11
 

the only issue i have with jquery is that its much slower than prototype or mootools in FF/Safari/Opera environments. It shines in IE though, which I suppose is both good (for most people out there) and bad (for developers).

 
Magento Community Magento Community
Magento Community
Magento Community
 
sharistump
Member
 
Avatar
Total Posts:  33
Joined:  2007-09-05
 

I second this. I’ve found that jquery is significantly, perceptibly faster than prototype in my experience. Especially the 1.2.6 version, out now.

It also seems to be very active and maintained these days, whereas prototype and scriptaculous seem to be all but abandoned.

 
Magento Community Magento Community
Magento Community
Magento Community
 
chrisdarl
Member
 
Total Posts:  45
Joined:  2008-07-17
 

Agreed. Ditch Prototype! jQuery much better in my experience.

 
Magento Community Magento Community
Magento Community
Magento Community
 
oshipper
Member
 
Total Posts:  53
Joined:  2008-02-04
New York, NY
 

I know this is an impossible request but has anyone had any luck documenting all the instances of prototype/scriptaculous in the front end and backend? According to Varien they do not have this information but we can hire them to figure out where it is at $195/hr.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Scott
Guru
 
Avatar
Total Posts:  333
Joined:  2007-08-31
Northwest Ohio
 

The way Magento was developed, Prototype is built into the core for the most part. Literally every page has some type of Prototype JavaScript going on. To rip it out and replace with jquery, mootools, dojo, yui or anything else would be a significant overhaul and your efforts in doing so could potentially be thwarted during an upgrade.

With that being said, jquery has proven to be the fastest of all frameworks available, while prototype and yui tend to be the slowest.

Needless to say, using Prototype doesn’t help Magento’s case where performance is concerned wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
misteroriginal
Member
 
Total Posts:  48
Joined:  2008-03-26
 

Here’s a nice little benchmark of MooTools vs jQuery vs Protoype vs YUI vs Dojo:
http://mootools.net/slickspeed/

 
Magento Community Magento Community
Magento Community
Magento Community
 
ylibrach
Sr. Member
 
Total Posts:  78
Joined:  2008-07-06
 
misteroriginal - 22 September 2008 10:23 AM

Here’s a nice little benchmark of MooTools vs jQuery vs Protoype vs YUI vs Dojo:
http://mootools.net/slickspeed/

That URL is a perfect example of one of the reasons to ditch Prototype. It comes up slower in almost every test in Firefox 3. Also almost all plugins available on the net today are written in jQuery.

Is the Magento team at least CONSIDERING switching to jQuery in the future?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ShopGuy
Guru
 
Total Posts:  462
Joined:  2008-09-07
 

I am sure that if jQuery is superior according to what Varien values (speed is only part of the equation… Stability, plugin support, knowledge of current developers, etc play a role), then they will switch. The move from jQuery to prototype would not be that difficult. Especially in the frontend. Most would be copy / paste. The backend might be more difficult, but doable.

 
Magento Community Magento Community
Magento Community
Magento Community
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

I got these results from that MooTools test:

--------------------- FF 3.0.8 ----- opera 9.63 -------- IE70.5730.11 ------ Average----Weighted Average*
MooTools 1.2 ----- 1033 ------- 448 ---------------- 7514 -----------------2998---------5894
JQuery 1.2.6 ------- 1125 ------ 375 ---------------- 3202 ------------------1567--------2683
Prototype 1.6.0.2 —526 ------- 361 ---------------- 22712 ----------------23599------17166
YUI 2.5.2 ----------- 2665 ------- 1199 -------------- 11280 ----------------5048--------9126
Dojo 1.1.1 ----------- 618 ------- 188 ---------------- 4978 ------------------1928--------3888

Totals: ---------------5967--------2571----------------49686

* My Weighted Average takes into account a traffic profile of 75% visitors using IE and 25% FF. No break-down of versions taken into account.

I had always found Magento to run much faster in Opera than any other browser.

So indeed based on current browser usage for my traffic profile, JQuery would be over 6 times faster than Prototype.

If only Opera was the most used browser… (Or at least IE the least used...)

Benefit of YUI of course is that you can load the libraries from Yahoo directly, giving you a BIG chance the user’s browser has them cached already.

 
Magento Community Magento Community
Magento Community
Magento Community
 
skippybosco
Enthusiast
 
Avatar
Total Posts:  796
Joined:  2008-10-03
 

You bring up a good point J.T., even with existing prototype libraries is there some value add in using the Google Hosted version instead of a local hosted version under the same reasoning you make to use YUI?

Even if not cached they are pulling the file from a distributed server farm more than not closer to them geographically.

The downside is that if they do not have it cached you are giving up the ability to combine the requests into a single .js (either via Fooman or some other process) which results in multiple round trips to get the files.

 
Magento Community Magento Community
Magento Community
Magento Community
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

I didn’t realize you could use the G hosted versions. I could try and run some basic performance tests with that as I’m not using fooman or other combining.

One issue with that approach on YUI is that Yahoo didn’t support the files coming over HTTPS. I’m not sure whether Google does. Implication is that you’d need to request them locally in pages like the cart and checkout. That’s what i did on osCommerce as I used all the YUI buttons.

 
Magento Community Magento Community
Magento Community
Magento Community
 
skippybosco
Enthusiast
 
Avatar
Total Posts:  796
Joined:  2008-10-03
 

Google does support HTTPS

ex: https://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js

You can also specify version and whether the library is sent compressed or not compressed.

 
Magento Community Magento Community
Magento Community
Magento Community
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

Cool, that’s good then. YSlow reports the same load time for secure and non-secure, but the HTTPS one visually drags a bit when loading in the browser but knowing Google, they’ll have it worked out at the fastest possible.

I also now see Google is hosting YUI, so presumably also HTTPS.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

I have a concern about using Google or any Hosted version for JS library. Who does maintenance for those codes?

A recent incident with a Mootools script I had on a client’s site (not Magento shop), was linked to googleapi which I was unaware of because it’s a plugin for the CMS client’s site uses.  One day the gallery just stopped working and I couldn’t figure why. The matter was solved soon after I posted a question to the forum, apparently the script was no longer compatible, but boy, that was not something I wanted it happens again in any site.

 
Magento Community Magento Community
Magento Community
Magento Community
 
skippybosco
Enthusiast
 
Avatar
Total Posts:  796
Joined:  2008-10-03
 

You specify the version of the code you want to use. Short of google removing the code from their server (which should not be the case since they are the one pushing this) you should be safe and can upgrade to a new version of the script when YOU are ready to do so.. not at the sites actions grin

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2