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.





strcmp()

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

Description

According to the man page, the strcmp() function compares the two strings s1 and s2. It returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2. It returns an integer less than, equal to, or greater than zero if s1 (or the first n bytes thereof) is found, respectively, to be less than, to match, or be greater than s2.

strcmp() due to its extended use in many applications, is usually assembly optimised for most architectures (actually most string functions are optimised). Obviously, it most likely is optimised for x86 and x86_64, but and most of the times for PowerPC too. In any case the glibc implementation compares 32-bit (or 64-bit depending on the arch) blocks where possible. 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).

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 has a much faster FSB (800Mhz vs 533Mhz for the G5 and the MPC8610), and given the performance in memcmp() we should expect something similar, since, after all, the difference of memcmp() and strcmp() is just a check for the zero byte (a branch, which should drop performance, but not much). However, we were greatly surprised to see that strcmp() is probably the reference implementation (doing byte compares, as shown by the throughput, ~800MB/s which is the speed of the FSB really), which made the Athlon slower even than the MPC8610 and up to the same level as the G4!! Comparing only glibc functions the G5 is more than twice as fast as the Athlon and more than 500% faster when using libfreevec! Though to be frank, this speed occurs only in aligned strings, for unaligned strings, performance drops badly on the PowerPC CPUs, while the Athlon retains the ~800MB/s speed.

This is really a great handicap of glibc, we're not talking about some exotic media encoding, but a commonly used string comparison function in the most widely used free C library!!! As you will see in the rest of the string functions, the situation is not much better and strcmp() is not just an exception, unfortunately. Lastly, libmotovec's version (tested on the G4), while it performs ok for smaller sizes, for some reason performance drops to an abysmal level for larger sizes, but libfreevec is consistently faster anyway.

SIMD

  • AltiVec
  • libfreevec
  • Memory operations
‹ memset() up strcpy() ›
  • 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.