can javascript run faster?

Discussion in 'JavaScript' started by totally beginner, Jun 23, 2005.

  1. #1
    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?
     
    totally beginner, Jun 23, 2005 IP
  2. KingSEO

    KingSEO Peon

    Messages:
    295
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    0
    #2
    avoid nested loops, recursive stuff and do your comparisons of arrays on sorted arrays instead of n^2 comps.

    ie: code better.
     
    KingSEO, Jun 23, 2005 IP
  3. dave487

    dave487 Peon

    Messages:
    701
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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?
     
    dave487, Jun 23, 2005 IP
  4. jorge

    jorge Peon

    Messages:
    202
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    maybe you can post your code here, we'll see what can be done to improve it
     
    jorge, Jun 23, 2005 IP
  5. ServerUnion

    ServerUnion Peon

    Messages:
    3,611
    Likes Received:
    296
    Best Answers:
    0
    Trophy Points:
    0
    #5
    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.
     
    ServerUnion, Jun 23, 2005 IP