emacs-devel
[Top][All Lists]
Advanced

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

Re: Why does adding a useless copy-sequence and discarding the result ma


From: Clément Pit-Claudel
Subject: Re: Why does adding a useless copy-sequence and discarding the result make my ELisp 40 times faster?
Date: Sat, 25 Mar 2017 09:54:15 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 2017-03-25 06:47, Andreas Politz wrote:
> Clément Pit-Claudel <address@hidden> writes:
> 
>> On 2017-03-25 00:06, Clément Pit-Claudel wrote:
>>> * Why does running additional, supposedly useless code speed things up so 
>>> much? (1)
>>
>> Interestingly, it turns out that (copy-sequence) isn't needed:
>> instead, it's enough to use (sleep-for 0.000001) (or even (sleep-for
>> cl-least-positive-normalized-float)) to get the 40x speedup.
> 
> What about this explanation: If you make Emacs wait inside the loop, it
> can send some of the strings immediately.  Otherwise, it'll have to
> store them all/some in memory first.

Possibly! But does this theory explain the following ((3) in my original email)?

(benchmark-send-string t   200  65536 "read")              → 
(0.18765710700000002 46  0.14072835099999995)
(benchmark-send-string nil 200  65536 "read")              → (3.397287521       
  0   0.0)

(benchmark-send-string t   1600 8192  "read")              → (0.258897164 49 
0.17045154200000004)
(benchmark-send-string nil 1600 8192  "read")              → (0.07095391 0 0.0)

Sending 1600 strings of length 8192 with or without sleeps is much faster than 
sending 200 strings of length 65536.

Thanks for your ideas!
Clément.



reply via email to

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