mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: embedded newbies site.
Date: Tue, 16 Jul 2013 15:56:47 +0200	[thread overview]
Message-ID: <20130716135646.GP15323@port70.net> (raw)
In-Reply-To: <CAFipMOH5Tz09SVBqz1sd=VRXpMu7gNUL+9gmLiB43z7cV9LjYg@mail.gmail.com>

* LM <lmemsm@gmail.com> [2013-07-16 07:50:29 -0400]:
> design.  For instance, there are some negative mentions about the PCRE
> library, but when I tried to track down the cons for using it, I only found
> dated performance comparisons showing how poorly it worked if you don't use
> the newer JIT implementation.  What might be a positive for a system that's

the pcre thing is a design decision that makes the worst
case asymptotic complexity exponential, the jit does not
help and benchmarks are irrelevant: they are about the
common case

russ cox gave a clear explanation:

http://swtch.com/~rsc/regexp/regexp1.html
http://swtch.com/~rsc/regexp/regexp2.html
http://swtch.com/~rsc/regexp/regexp3.html
http://swtch.com/~rsc/regexp/regexp4.html

jit can only speed up the execution of a compiled pattern
by some constant factor, it is also much more complex and
has greater startup cost than a classic nfa based engine

to fix the problem you need a different algorithm
(of course then many of the pcre features would be hard
to support)

if the regex input source is not in your control then
you should worry about worst-case performance, not the
average case one

if you check out the pcre benchmarks you can note that
it explicitly states that no "pathological" patterns were
used (ie ones which would make backtracking exponential)

http://sljit.sourceforge.net/regex_perf.html

and this is where the issue turns into an ideological debate:
should we train people how to avoid pathological cases or
should the algorithm guarantee good worst case performance on
any bounded input
(ppl seems to prefer instant gratification and common case
performance usually, but in a safety critical environment
you care about the worst-case more)


  reply	other threads:[~2013-07-16 13:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16  2:03 Rob Landley
2013-07-16  3:18 ` Strake
2013-07-17 12:07   ` LM
2013-07-17 13:58     ` Rich Felker
2013-07-20 15:17   ` James B
2013-07-22 12:27     ` Andrew Bradford
2013-07-22  4:40   ` Rob Landley
2013-07-23  0:12     ` Strake
2013-07-27  0:58       ` Rob Landley
2013-07-27  2:01         ` Strake
2013-07-27  2:50           ` Rich Felker
2013-07-29 20:01             ` Rob Landley
2013-07-29 19:54           ` Rob Landley
2013-07-30  1:35             ` Strake
2013-08-01  6:20               ` Rob Landley
2013-08-03 16:52                 ` Strake
2013-07-16 11:50 ` LM
2013-07-16 13:56   ` Szabolcs Nagy [this message]
2013-07-16 14:00   ` Rich Felker
2013-07-16 17:49   ` Strake
2013-07-22  6:00   ` Rob Landley

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=20130716135646.GP15323@port70.net \
    --to=nsz@port70.net \
    --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).