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: | Sascha Schumann | Date: | Wed, 13 Nov 2002 13:14:34 +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-16086@lists.php.net to get a copy of this message | ||
> 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)
It was like that until Aug 18th. A commit back then turned
the fast macro back into a slow function again and added a
division. With that kind of setup, the compiler has no
chance to reduce and optimize the target code.
By using emalloc+memset, we get compile-time reduction (no
multiplication at run-time) and inlining for free.
- Sascha