Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160920175732.GB7983@dell12.lru.li>
Date: Tue, 20 Sep 2016 19:57:32 +0200
From: Georg Sauthoff <mail@...rg.so>
To: musl@...ts.openwall.com
Subject: Re: memchr() performance

On Mon, Sep 19, 2016 at 07:58:48PM +0200, Szabolcs Nagy wrote:
> * Georg Sauthoff <mail@...rg.so> [2016-09-19 15:29:53 +0200]:

> > Yes. Sure, ub means that anything can happen, but this case should be ok
> > with GCC - if the function is compiled in isolation in its own
> > translation unit.
 
> unless you use lto
 
> (which musl does not support now, but ppl are doing this)

Yes, with lto there is no isolation.

For lto you can do one of the following:

- write a version in pure assembler, doesn't have to be harder to read
  than a C version

- use the may_alias attribute (supported at least by GCC/Clang)

- apply the memcpy() trick:
  https://github.com/gsauthof/find-memchr/blob/master/find_avx2_memcpy_impl.cc

Best regards
Georg

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.