1) You don't need to save length property in a for loop. That gives you 
nothing.

2) If you curious about performance just do benchmarks! E.g with 
http://benchmarkjs.com/.

3) Don't bother with performance unless you really know context. I.e. 
impact of procedure in question on overall performance.

4) Remember that it's easy to get wrong notion.

5) For general overview of the topic the following might be helpful
  - talk about v8 performance 
optimizations<http://www.youtube.com/watch?v=Z_q6iw3h48s>
  - Felix Geisendörfe talk about how he did performance optimizations for 
mysql lib <http://vimeo.com/56444583>

On Saturday, April 27, 2013 2:52:58 PM UTC+4, Dimitri Bouriez wrote:
>
> Hi all,
>
> I'm working on a multiplayer game where each player's informations is 
> stored in an array of objects indexed by the id of the players. All 
> treatments are done on the players by functions.
>
> That is to create an object with player informations and functions will 
> degrade performance ? I have nearly a thousand players connected 
> simultaneously, whereby the features to be created 1000 times. Or store the 
> information in an array is the fastest way with functions outside ?
>
> Here's how I build the array of players (in a loop):
>
> var playerId = rows[i].playerId;
> player[playerId] = {};
> player[playerId].name = rows[i].name;
> player[playerId].email = rows[i].email;
> player[playerId].money = rows[i].money;
>
>
>
> I know that the fastest way to iterate through the array of objects is a 
> way to do like this:
>
> for(var i = 1, len = player.length; i < len; i++) {
> console.log(player[i]);
> }
>
>  
> Thank you, and sorry for my poor English, i'm french.
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to