[Top][All Lists]

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

Re: Guile's time execution issues

From: Ludovic Courtès
Subject: Re: Guile's time execution issues
Date: Mon, 04 May 2020 11:36:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)


Aleix Conchillo Flaqué <address@hidden> skribis:

> So weird I'm getting different numbers on 2.2.7. Not sure how I'm getting 
> those initial ~20s and you are getting consistent ~ 45s. It
> shouldn't have nothing to do with it, but could it be I'm running it on macOS?

Did you add this ‘->bool’ call to ensure the resulting alist is not kept
in memory?

>  Now, it would be good to profile ‘json->scm’ to see if there’s anything
>  that could be improved on the Guile side, or if it’s just a normal
>  profile for GC-intensive code.
> Good news is that I have been working on performance improvements and 
> json->scm is going down from my ~19 seconds to ~3
> seconds on the same sample file. Linus Björnstam was the one to bring up 
> performance issues so we've been back and forth trying to
> make it fast.


> 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…)


reply via email to

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