bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strstr is linear test fails on my machine with glibc 2.13


From: Eric Blake
Subject: Re: strstr is linear test fails on my machine with glibc 2.13
Date: Tue, 19 Jul 2011 10:30:57 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.11

On 07/19/2011 09:30 AM, Reuben Thomas wrote:
I was interested to see this test fail, and digging inside, see
comments assert that glibc>  2.12 should be OK. Looks therefore as if
something's wrong. I'm using the glibc 2.13 shipped with Ubuntu natty
on an x86_64 system. The test exits with status 142, i.e. 128 + 14,
i.e. the 5-second alarm has fired. I have a 2.5GHz i5 Sandy Bridge
CPU.

Known glibc bug when using glibc 2.11 or newer on an SSE4.2-enabled chip:
http://sourceware.org/bugzilla/show_bug.cgi?id=12100


memmem is on the other hand diagnosed as linear on my system.

Yep - because memmem isn't "optimized" for small strings.

The _real_ fix would be to write a patch that uses hueristics - SSE4.2 for short needles and linear algorithm for long needles (the SSE4.2 optimizations are indeed faster for short needles, but scale quadratically; for large needles, using SSE4.2 doesn't provide quite the speedups). But it takes time to write not only the patch, but also the timing programs that will definitively prove that we are not pessimizing speed over a large set of inputs (short vs. long needles, repetitive vs. unique needles, SSE4.2 vs. older chip, ...).

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]