emacs-devel
[Top][All Lists]
Advanced

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

Re: JSON/YAML/TOML/etc. parsing performance


From: Eli Zaretskii
Subject: Re: JSON/YAML/TOML/etc. parsing performance
Date: Mon, 09 Oct 2017 09:38:45 +0300

> From: Philipp Stephani <address@hidden>
> Date: Sun, 08 Oct 2017 22:52:36 +0000
> Cc: address@hidden
> 
> Paul Eggert <address@hidden> schrieb am Do., 5. Okt. 2017 um 03:48 Uhr:
> 
>  One idea here is
>  that there is no need for eassert (E) unless there's a genuine doubt
>  that E will be true (in some cases the removed eassert (E) calls were
>  ineffective anyway, due to preceding eassume (E) calls). The patch cuts
>  down the number of integer overflow checks to six in json.c, if I'm
>  counting correctly, and that should be good enough.
> 
> I don't understand why minimizing the number of checks and assertions should 
> be a worthwhile goal. At the
> very least, the assertions document the assumptions that we make about the 
> values, and as such they are
> valuable even if they never trigger. 

My criterion for adding eassert(E) is that the following conditions
all hold:

  . the code below it assumes E is true
  . the code below it will not work correctly if E is false, but will
    not immediately abort or segfault (which also means the code has
    no defenses against E being false)
  . E being false "should never happen", i.e. it's deemed impossible




reply via email to

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