Subject: Re: bug#18522: 24.4.50; mapcar is very slow

From: Eli Zaretskii <[email-masked]>
Date: Fri, 19 Feb 2016 10:38:59 +0200

> From: Lars Ingebrigtsen <[email-masked]>
> Date: Fri, 19 Feb 2016 16:15:08 +1100
> Cc: [email-masked]
> 
> Peter Münster <[email-masked]> writes:
> 
> >> (benchmark-run 1
> >>  (dotimes (i 10000)
> >>   (parse-time-string "Fri, 13 Feb 2015 14:40:02 +0000")))
> >>
> >> run faster in a newly started Emacs than in one that has been running
> >> for a long time?
> >
> > Hi Lars,
> >
> > It becomes slower and slower:
> 
> [...]
> 
> Cool!  Then at least we've found the culprit.  :-)
> 
> Now we just have to find out why.  Does anybody have any idea?  Could
> somebody else also try running the benchmark form up there in a newly
> started Emacs and one that's been running for a while to see if they can
> reproduce this bug?

IMO, the benchmark needs to be changed to factor out GC, because the
time a GC takes depends on the number and structure of objects you
have in your session, and that has nothing to do with the issue at
hand.

So a better benchmark is this:

  (let ((gc-cons-threshold most-positive-fixnum))
    (benchmark-run 1
      (dotimes (i 10000)
	(parse-time-string "Fri, 13 Feb 2015 14:40:02 +0000"))))

FWIW, this takes 1.2 sec in a fresh "emacs -Q", and 2.0 sec in a
full-blown session running for 5 days.  That's clearly different from
the data presented by Peter (but I don't use Gnus).