guile-devel
[Top][All Lists]
Advanced

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

Re: Guile's time execution issues


From: Linus Björnstam
Subject: Re: Guile's time execution issues
Date: Mon, 04 May 2020 13:19:34 +0200
User-agent: Cyrus-JMAP/3.3.0-dev0-351-g9981f4f-fmstable-20200421v1

On Mon, 4 May 2020, at 11:36, Ludovic Courtès wrote:
 
> > One thing I found is that `match` is slow. The code looked nicer but had to 
> > change it back to lets and conds as the performance
> > increase was ~2 seconds.
> 
> Oh, in which case exactly?  And are you sure your hand-written code is
> equivalent to the ‘match’ code (it’s common for hand-written code to be
> more lax than ‘match’)?
> 
> One thing to pay attention to is the use of ‘list?’, which is O(N), and
> is implied by ellipses in ‘match’.  If you want to use ‘match’ in a way
> that avoids ‘list?’, write patterns such as (a . b) instead of (a b ...).
> It doesn’t have the same meaning, but often the end result is the same,
> for instance because you’ll later match on ‘b’ anyway.
> 
> (I wish we can one day have a proper list type disjoint from pairs…)

The change is here: he is only matching against chars and predicates: 
https://github.com/aconchillo/guile-json/commit/ad4b06d86e4822466983d00f55474c8f664b538d




reply via email to

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