mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Andre McCurdy <armccurdy@gmail.com>
To: musl@lists.openwall.com
Subject: Re: towlower performance
Date: Fri, 26 May 2017 17:39:31 -0700	[thread overview]
Message-ID: <CAJ86T=XRrvspiJb4whak3qHpWu44FFD8gkrjHB7mghr-Le6epA@mail.gmail.com> (raw)
In-Reply-To: <VI1P192MB011211DE6A9BDC8F4AF61CB6FBFF0@VI1P192MB0112.EURP192.PROD.OUTLOOK.COM>

On Thu, May 25, 2017 at 11:01 AM, maksis .
<maksis@adrenaline-network.com> wrote:
> Hi,
>
> After switching my C++ app from a glibc-based build to a static build using
> musl, I've noticed significant differences in performance with certain
> loading operations, which seems to be related to using std::map with a
> case-insensitive UTF-8 sorting algorithm. For example, parsing a XML file
> with a flat listing of ~350k directory items and mapping them by name takes
> about 3 seconds with glibc vs 13 seconds with musl. After modifying the sort
> algorithm by removing all calls to towlower, the loading time with musl
> drops to 3.5 seconds.
>
> I put together a C++ benchmark with the same sorting algorithm, which seems
> to produce similar results (GCC 6.3, 64 bit, -O3):
>
> https://gist.github.com/maksis/92ad04f525d69043283350675d04f160
>
> glibc: ~2 seconds (Arch Linux)
>
> musl: ~7 seconds (Alpine Linux 3.6.0)
>
> What might be causing the difference?

I'm not sure if it maps directly to your results, but when building a
gcc based musl toolchain, libstdc++ gets configured to use the
"generic" OS specific include dir, which seems to contain some less
than optimal ctype code. e.g. ctype_inline.h comes with the following
warning:

  // The following definitions are portable, but insanely slow. If one
  // cares at all about performance, then specialized ctype
  // functionality should be added for the native os in question: see
  // the config/os/bits/ctype_*.h files.

  https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/config/os/generic/ctype_inline.h


  reply	other threads:[~2017-05-27  0:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25 18:01 maksis .
2017-05-27  0:39 ` Andre McCurdy [this message]
2017-05-27  0:59   ` Rich Felker
2017-05-30 12:23     ` [PATCH] towupper/towlower: fast path for ascii chars Natanael Copa
2017-05-31  3:04       ` A. Wilcox
     [not found] <1871525485.1112020.1495912199619.ref@mail.yahoo.com>
2017-05-27 19:09 ` towlower performance Brad Conroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ86T=XRrvspiJb4whak3qHpWu44FFD8gkrjHB7mghr-Le6epA@mail.gmail.com' \
    --to=armccurdy@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).