Re: Array mysteries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, March 11, 2007 2:57 pm, Edward Vermillion wrote:
> Would the array lookup be faster for a lesser-used option/key in a
> situation where there were quite a few options? (you wouldn't have to
> go through the whole switch to get to the option at the end (?) or
> would you? I have no idea how that all works internally)

Almost for sure, a 'switch' is going to win over the array hash lookup
in almost all cases, as the switch is built into the opcodes, and not
an array hash lookup.

If I understood a thread on Internals last month correctly,
internally, the order of the case statements does matter, somewhat,
but you *DO* have to be calling something a ZILLION times for it to
matter in the real world.

Stressing out over performance instead of maintainability is almost
always the wrong way to start a project.

You don't want to be a complete idiot, but often-times the performance
bottle-neck ends up being somewhere entirely different from where you
expected anyway.

Write the code as straight-forward and maintainable as you can first.

Then measure it for performance to see if it's acceptable.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux