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:
> >sas Wed Nov 6 12:59:04 2002 EDT
> >
> > Modified 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.c
> > Log:
> > emalloc never returns 0, so we can simplify the code paths.
> > also replace ecalloc with emalloc+memset, so that the latter can be
> > inlined.
>
> Could 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.

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.
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)

marcus

   Have a look at the assembler code here
    http://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

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

Reply via email to