views:

61

answers:

3

I want to make my component faster, I am using Javascript and JQuery to build that. I am using JSON object to communicate with component and back-end is python. Is there any suggestion to make component faster?

+1  A: 

Setup some analysis to see what takes time to process. Then decide if you want to try to optimize the javascript and client code, the communication up/down with the server or the actual speed of the python execution. When you have decided what you want to make faster, you can post samples of that to this site and people will probably be willing to help you.

jarrett
+1 for the guidance....
Reigel
A: 

On the client side, you can benchmark your script(s) using getTime()

var start = (new Date).getTime();
 /* Run your script. */
var diff = (new Date).getTime() - start;
alert(diff)

And see what is taking long in a script exactly. But its hard do tell what could be optimized if you don't post any code.

meo
Actually we are making lots of components and merge them to make one full project.so overall that project is slower but all component individually are faster enough.. so is there any tips how to make component with jquery and javascript?
Dhaval dave
the only thing you can do is analyze what is taking long to load. (With google chrome or firebug on firefox you can watch the loading times and hierarchy)
meo
A: 

If speed is the issue, and you by profiling discover that js is the culprit, then I would look into replacing the jQuery with vanilla javascript, or a more optimized library.

As jQuery tries to do 'everything' and trains its users into wrapping everything in $(), its bound to introduce unnecessary method calls (I've seen that a single call to $() can result in upto 100+ method calls).

Sean Kinsey