Hi Richard, Andrei, Hold on about a patch to optimize add_assoc_* and hard-coded keys. I just finished some testing to see what difference it makes: none! :-) Compilers must optimize strlen("static string") to the literal value; at least VC++ Express does. Using a dynamic string from estrdup(), *_ex with the hard-coded length was about 10% faster with a 12 character key on my old system (dual 930MHz). But again, no difference with static ones like in PHP's code. It was an optimization though in array_combine(), being dynamic key values.
So, nothin' to worry about here... :-) Matt ----- Original Message ----- From: "Matt W" Sent: Saturday, July 22, 2006 > Hi Richard, > > Replacement script made it pretty simple I guess. :-) But sizeof("key")+1 > should just be sizeof("key") (which == strlen("key")+1). > > Are there any uses of add_u_assoc_* with hard-coded keys? > > These changes make things look a little messy, you think? The string is in > 2 places, etc... (Maybe why it wasn't done in the first place?) Seems like > that ZEND_STRS() macro you mentioned would work well. Or maybe cleanest > would be some new add_static_assoc_* macros (and _u versions if needed), or > some other naming convention, that uses sizeof() instead of strlen()+1. > > What do the main devs think? > > > Matt -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php