Re: [PHP-DEV] function table / hashes
On 2001-04-27 11:27:55, Andi Gutmans [EMAIL PROTECTED] wrote: At 12:03 AM 4/27/2001 -0400, David Croft wrote: Thank you Andi and Andrei. I have noticed that object method callbacks are consistently faster than global function callbacks, and was wondering why: Perhaps because the method only needs to be found in the hash for the object? --Wez. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] function table / hashes
At 01:10 PM 4/27/2001 +0100, Wez Furlong wrote: On 2001-04-27 11:27:55, Andi Gutmans [EMAIL PROTECTED] wrote: At 12:03 AM 4/27/2001 -0400, David Croft wrote: Thank you Andi and Andrei. I have noticed that object method callbacks are consistently faster than global function callbacks, and was wondering why: Perhaps because the method only needs to be found in the hash for the object? It shouldn't really make a difference because it's a hash table. Andi -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] function table / hashes
At 12:03 AM 4/27/2001 -0400, David Croft wrote: Thank you Andi and Andrei. I have noticed that object method callbacks are consistently faster than global function callbacks, and was wondering why: 1.3135770559311 seconds for 10 runs - with no function callback 6.9758139848709 seconds for 10 runs - with object method callback 7.9048730134964 seconds for 10 runs - with global function callback This is somewhat strange for me as I would expect objects to be slower if it has to look up the class and then locate the function table? No idea. The global function's should be faster. I'm exploring hashes now. I find code like this in php_imap.c: if (zend_hash_find(Z_ARRVAL_PP(envelope), remail, sizeof(remail), (void **) pvalue)== SUCCESS) { convert_to_string_ex(pvalue); env-remail=cpystr(Z_STRVAL_PP(pvalue)); } Is that legal? It seems that it would alter the original array by forcing conversion to string. It really depends what was put in the hash and the semantics of the code. I'd have to read the code to understand what is being done there. Lastly, I am trying to see the difference between zend_hash_find and zend_hash_quick_find. Would I be correct in assuming quick_find only looks at string keys, and it would be safe to use this if the function expects only associative arrays? quick_find() is also passed the hash value so it saves a tiny amount of time by not having to compute the hash value of the string. I'm not sure how much this really helps. Andi -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] function table / hashes
Thank you Andi and Andrei. I have noticed that object method callbacks are consistently faster than global function callbacks, and was wondering why: 1.3135770559311 seconds for 10 runs - with no function callback 6.9758139848709 seconds for 10 runs - with object method callback 7.9048730134964 seconds for 10 runs - with global function callback This is somewhat strange for me as I would expect objects to be slower if it has to look up the class and then locate the function table? I'm exploring hashes now. I find code like this in php_imap.c: if (zend_hash_find(Z_ARRVAL_PP(envelope), remail, sizeof(remail), (void **) pvalue)== SUCCESS) { convert_to_string_ex(pvalue); env-remail=cpystr(Z_STRVAL_PP(pvalue)); } Is that legal? It seems that it would alter the original array by forcing conversion to string. Lastly, I am trying to see the difference between zend_hash_find and zend_hash_quick_find. Would I be correct in assuming quick_find only looks at string keys, and it would be safe to use this if the function expects only associative arrays? Thanks again! David -- | /+\ \| | | David Croft Infotrek On Thu, 26 Apr 2001, Andi Gutmans wrote: At 02:16 PM 4/26/2001 -0400, David Croft wrote: Hello, I'm implementing an extension that allows user callbacks. The Zend API document suggests using the Compiler globals to access the function table. However I see the XML extension is using Executor globals. During execution the correct table to use is the executor globals one, i.e., EG(function_table). Andi -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]