• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javascript performance discussion wanted

 
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is javascript really that slow?

At work we are just starting to write a new ExtJS front end to our app and 2 gurus are doing all of the code reviews.
They are quibbling (my opnion) that i use the wrong type of for loop as a is more efficient than a foreach loop.

are they being sensible?>
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's quite a bit of information on this if you google it. The general consensus seems to be that foreach loops are slower. And it seems to be slower/faster depending on the browser. If your app is very front-end heavy then I wouldn't consider it to be "quibbling".
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or is this just a case of premature optimization?

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Or is this just a case of premature optimization?



Quite possibly. I would just say that if you know something is slow and there is already an alternative then why use the slow one? It just becomes something you have to go back and refactor later.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps but in this case I've never seen a difference in performance that has had any visible effect.

For the record I use both styles -- choosing whichever seems to fit the situation better or improve the clarity of the code.
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys,I have done some reading and with the newer browsers it doesn't make that much difference but as we are mainly going over arrays, it makes it easier anyway.

And our front end is very very heavy, it makes HTML look and behave like swing (but with enough differences to keep you irritated).
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right that it does not make a difference anymore. Most bottlenecks come from poor design decisions and people refusing to change backends to fit the front end needs.

Eric
 
reply
    Bookmark Topic Watch Topic
  • New Topic