Re: cvs: php4 /ext/dba dba.c dba_cdb.c dba_db2.c dba_db3.c dba_dbm.c dba_flatfile.c dba_gdbm.c dba_ndbm.c
| From: | (Marcus Börger) | Date: | Wed, 13 Nov 2002 13:02:01 +0000 |
| Subject: | Re: cvs: php4 /ext/dba dba.c dba_cdb.c dba_db2.c dba_db3.c dba_dbm.c dba_flatfile.c dba_gdbm.c dba_ndbm.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-16084@lists.php.net to get a copy of this message | ||
At 13:37 13.11.2002, Sascha Schumann wrote:
On Wed, 13 Nov 2002, Marcus Börger wrote: At 18:59 06.11.2002, Sascha Schumann wrote:You're right the compiler knows the size in the caller function but not in ecalloc of cause. Shouldn't then ecalloc be a compiler define? #define ecalloc(num, size) \ memset( emalloc(num*size), 0, num*size) marcusCould you explain what you meant with the second part? ecmalloc is a call that uses memset. If memset can be inlined it would be inlined in ecalloc as well as in the other place. In other words i do not see the difference.sas Wed Nov 6 12:59:04 2002 EDTModified files:/php4/ext/dba dba.c dba_cdb.c dba_db2.c dba_db3.c dba_dbm.c dba_flatfile.c dba_gdbm.c dba_ndbm.cLog: emalloc never returns 0, so we can simplify the code paths. also replace ecalloc with emalloc+memset, so that the latter can be inlined.The difference is the placement of the memset call. After the changes, a compiler which does not optimize across function borders can inline the memset call (e.g. GCC). memset() is a lot faster, if the compiler knows the size of the data field.
Have a look at the assembler code herehttp://www.mail-archive.com/dev@httpd.apache.org/msg02492.html- Sascha-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php