Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Jan 2009 18:27:02 +0000 (UTC)
From:      David Schultz <das@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/include stdlib.h string.h wchar.h src/sys/sys cdefs.h malloc.h
Message-ID:  <200901311832.n0VIW8Ma016564@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
das         2009-01-31 18:27:02 UTC

  FreeBSD src repository

  Modified files:
    include              stdlib.h string.h wchar.h 
    sys/sys              cdefs.h malloc.h 
  Log:
  SVN rev 187961 on 2009-01-31 18:27:02Z by das
  
  Add a function attribute called `__malloc_like', which informs gcc
  that the annotated function returns a pointer that doesn't alias any
  extant pointer. This results in a 50%+ speedup in microbenchmarks such
  as the following:
  
      char *cp = malloc(1), *buf = malloc(BUF);
      for (i = 0; i < BUF; i++) buf[i] = *cp;
  
  In real programs, your mileage will vary. Note that gcc already
  performs this optimization automatically for any function called
  `malloc', `calloc', `strdup', or `strndup' unless -fno-builtins is
  used.
  
  Revision  Changes    Path
  1.68      +2 -2      src/include/stdlib.h
  1.28      +2 -2      src/include/string.h
  1.47      +1 -1      src/include/wchar.h
  1.97      +2 -0      src/sys/sys/cdefs.h
  1.88      +2 -2      src/sys/sys/malloc.h



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901311832.n0VIW8Ma016564>