Re: Best method to increment a variable.



On Sun, 16 Dec 2007 02:46:22 -0800, Steve wrote:

Several textbooks, including Javascript for Dummies (2005), show the
"i=++i" method of incrementing a variable. I have been using this method
but I have been recently informed by some experts in the Google Maps API
group that this method is confusing and wasteful of resources and is now
redundant and I should use "++i" or "i=i+1". Any strong opinions in this
group?

Profile your code first! There is absolutely zero point in optimizing
something which may have 1% or less performance degradation on your code.
Instead, work at optimizing your code which consumes most of the CPU. Use
firebug's profiler to determine the functions your code is spending most
of its time.

Without taking any direct measurements, I would assume i++ and ++i will
be the most efficient when using most javascript engines because the
other expressions will probably introduce temporary variables.
.



Relevant Pages

  • Re: Best method to increment a variable.
    ... group that this method is confusing and wasteful of resources and is now ... Profile your code first! ... work at optimizing your code which consumes most of the CPU. ... TP/BP/Delphi/jscr/&c, FAQ items, links. ...
    (comp.lang.javascript)
  • Re: Event ID 1500 and 1508 - user cannot login
    ... It's not common in my experience. ... Resource cleanup with Windows 2003 TS should only become a factor due to specific misbehaving applications, drivers, etc and should be addressed at the level. ... reboot the server pretty consistently to clean up resources. ... Profile> Do not ...
    (microsoft.public.windows.terminal_services)
  • Re: Connecting to other domain profile
    ... > his XP laptop to our domain so that he could use our network resources. ... > that he doesn't have to worry about reconnecting to his domain when he ... > back to the home office. ... if we can not reconnect to that profile ...
    (microsoft.public.windowsxp.network_web)
  • Re: Event ID 1500 and 1508 - user cannot login
    ... Check to see if the server is really low on resources, ... check for user ownership of Roaming Profile Folders - this can become an issue if ownership was changed. ... you are connected to the network, or that your network is functioning ... DETAIL - Insufficient system resources exist to complete the requested ...
    (microsoft.public.windows.terminal_services)
  • Re: Turning off Reminders for Resource Mailboxes
    ... > each resource/room has it's own mailbox that can be foudn in the GLobal ... > created a profile that is linked to the mailbox for the room. ... this then bombards me with all the reminders from ... >> When you say you set them up as resources, did you create a mailbox for ...
    (microsoft.public.outlook.calendaring)