freevec.org

  • about
  • benchmarks
Home › libfreevec 1.0.4 benchmarks updated!

Search

Primary links

  • About
    • History of libfreevec
  • Benchmarks
    • libfreevec

Please donate to libfreevec to ensure its continuing development! Donations are done via Paypal.





memchr()

markos — Tue, 29/01/2008 - 17:39

Description

According to the man page, memchr() The memchr() function scans the first n bytes of the memory area pointed to by s for the character c. The first byte to match c (interpreted as an unsigned character) stops the operation. It return a pointer to the matching byte or NULL if the character does not occur in the given memory area.

The glibc implementation searches for the char using 32-bit (or 64-bit depending on the arch) blocks and bitmasking. In libfreevec we also do that, but as we already have stated, we also use modern SIMD units (AltiVec for PowerPC CPUs, and in the future SSE for x86 CPUs). This has the effect that for smaller sizes, the performance is the same but for larger sizes performance increases dramatically.

Each CPU in detail:

And for comparison here is the result of the same benchmark run on an Athlon X2 5000 (2.5Ghz), running 32-bit code:

Results/Comments

The Athlon's fast integer units show a substantial gain in all cases (almost 2x as fast as the G5), but of course this also has to do with the fact that glibc includes an assembly optimized version of memchr(). However once Altivec kicks in, the G5 is almost 300% faster than the asm i686 version (remember we're running the benchmarks in 32-bit mode, 64-bit mode will follow). An increase in performance is expected also when SSE is used, but due to the nature of this SIMD unit, we don't expect it will outperform the G5/AltiVec combination. Plus, the all-CPU chart is showing only aligned (best-case) scenarios. In the Athlon-specific chart, memchr() performs inconsistently when doing unaligned accesses, which does not happen with the powerpc functions.

SIMD

  • AltiVec
  • libfreevec
  • String searching
‹ memccpy() up memcmp() ›
  • Login or register to post comments

SIMD

  • Algorithms (31)
    • Algebra (9)
      • Matrix operations (8)
    • Bit operations (0)
    • Codecs (0)
      • Audio (0)
      • Video (0)
    • Comparison (0)
      • image comparison (0)
      • Levenshtein (0)
    • Compression (0)
      • Bzip2 (0)
      • Gzip (0)
      • LZMA (0)
      • LZW (0)
      • Squashfs (0)
      • Zlib (0)
    • Encryption (0)
      • AES (0)
      • DES (0)
      • RSA (0)
      • Salsa (0)
      • SSL (0)
    • Hashing (1)
      • CRC (0)
      • TCP/IP checksum (0)
      • UMAC (0)
    • Memory operations (15)
    • Multiprecision (0)
    • Searching (5)
      • String searching (5)
    • Sorting (0)
  • Software (32)
    • Benchmarking (2)
    • Libraries (30)
      • Eigen2 (0)
      • libfreevec (22)
      • simdX86 (8)
  • Architecture (32)
    • AltiVec (32)
    • ARM NEON (0)
    • CELL SPU (0)
    • SSE (0)
    • VIS (0)

User login

  • Create new account
  • Request new password
  • about
  • benchmarks

Copyright (c)2008 by CODEX.
Powered by Drupal. Using theme Deco.
All Google charts have been created by the CSV Chart and Chart API Drupal modules.