Photos:

China pictures processed

 
0%
 
2006.05.22 @20:39 

My Anti Virus loves me ... too much.

My Anti Virus loves me ... too much.

At work, the product manager of the piece of software we are developing based on Joomla!, asked us at some point "Why the admin console is so bloody slow ???".

Well indeed, a simple html page was taking ages to be built and/or downloaded on a LAN with the server being an outrageously powerful piece of hardware for the job to be done. And the server was 10 meters away from my laptop.

Ok joomla is definitely not a racing horse but still, why oh why taking 5 or 6 seconds to build a simple admin page every time we click on something (and joomla users know that a lot of page refreshes are needed if you want to do anything).

Strangely enough the same pages under Firefox are lightning fast. Sadly the target is Internet Explorer only. I had to investigate all down the line, put timers everywhere in the php and javascript code etc... Result of the battle: FF 0.3 secs, IE 4.3 secs at its best !

This, in fact, comes from the admin menu printed as a banner on all admin pages. This is built using another opensource piece of software called JsCookmenu. Rather than being processed on the server, it is built from a multidimensionnal array by the javascript itself. Hmmm well ok, why not.

Quickly enough I was able to determine that the problem was coming from the way it is built : a 60 KB(!) string that the browser must parse on the fly (because built by javascript) before a classic innerHTML setter. Huh ok, innerHTML was "invented" by IE but definitely looks quite slow here, weird... but us - as (a little bit) geeks - tend sometimes to drop the investigations thinking "hey whatever, FF beats IE clearly, cant compare isnt it ?".

Until I found another computer not on our LAN where suddenly the admin was quite fast. My mind clicked this time ! Oh bloody stupid macafee get out of my way ? Reload --> lightning fast !

What's the problem ? Simply that this menu (by the way only around 50 items) is intensively based on "onmouse*" kind of events. Each of the 50 items (and the spacers !) has the 4 : onmouseup, onmousedown, onmouseover, onmouseout events defined. So everytime the html parser finds the start of an event definition the browser gives the control to the anti-virus that instantiates lots of stuff just to parse a 50 bytes string and imply replies "this is a virus or not..." and trashes everything. And this takes something like 0.2 secs (!) and 100% CPU every time of every event assignation of every menu item of every page... Even if of course this is the same code EVERY time ! In this menu this is actually exactly the same string as this is the same call every time, even the parameters are the same if I remember well.

The result is that the poor computer is completely STUCK for 4 seconds (100 % CPU, cant click on anything on the page). Nice one.

It was already quite a pain these "On access scanners" when it slows down the launching of any program because of the .exe scan prior to it but on the other hand this is indeed a nice protection for non-techies who dont really know much about viruses. But now, completely screwing the computer while checking all the small javascripts handlers strings every time is a hell of a nightmare ! 

So, If you are using joomla! and you find it slow on the admin console : disable your anti virus, if sometimes you find web pages that seem too slow to be because of the network latency, try disable your antivirus before a refresh... you never know, it can make your life easier.

Be AFRAID of javascript you people, you never know how evil this technology is. Or is it evil anti virus technology ?

2 Comments
  1. arluison guillaume (false) said:

    Thursday, March 19, 2009 at 10:25

    je apprendre comment injecter un virus dans un ordinateur

  2. Archange said:

    Thursday, March 19, 2009 at 12:52

    hello angolan friend (sorry I'm not speaking portuguese). I hope you dont want to know how to inject a virus into a computer but how to clean a computer from a virus. By the way, unless a really weird luck I dont think your name is 'arluison guillaume'. I cant say it is _only_ mine since it may have been given to another human on earth but I doubt this is your name. Good luck in your future endeavours...

Post a Comment
Comments have been deactivated thanx to screwers.