Myspace Comments - Mortgage - Flights - Mortgage - Myspace Comments

PDA

View Full Version : can javascript run faster?


totally beginner
Jun 23rd 2005, 12:31 am
i have a javascript code that huge enough (because so many loop & create new element:p ).

does anyone know how to make a javascript program can run faster?:rolleyes:

does anyone know/have program that can simplify my javascript program (maybe a program that automatically remove something not important in javascript code like remarks & indentation) so my javascript program's size can be smaller and faster to load from internet?

KingSEO
Jun 23rd 2005, 12:44 am
avoid nested loops, recursive stuff and do your comparisons of arrays on sorted arrays instead of n^2 comps.

ie: code better.

dave487
Jun 23rd 2005, 7:17 am
Are you collecting info from a form?

If so you could maybe try collecting some of the information using a server side script first and then using this information to reduce the amount of javascript that you need to run?

jorge
Jun 23rd 2005, 7:23 am
maybe you can post your code here, we'll see what can be done to improve it

ServerUnion
Jun 23rd 2005, 8:45 am
I have noticed that javascript doesn't scale that well. If your arrays start to get pretty big, the client machine wil choke. I also agree with the loops and nesting.