guile-devel
[Top][All Lists]
Advanced

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

Re: wip-ports-refactor


From: Ludovic Courtès
Subject: Re: wip-ports-refactor
Date: Tue, 19 Apr 2016 16:15:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hello!

Andy Wingo <address@hidden> skribis:

> On Sun 17 Apr 2016 12:44, address@hidden (Ludovic Courtès) writes:
>
>> Andy Wingo <address@hidden> skribis:
>>
>>> I want to test four things.
>>>
>>>     ;; 1. How long a loop up to 10 million takes (baseline measurement).
>>>     (let ((port (open-input-string "s"))) (do-times #e1e7 1))
>>>
>>>     ;; 2. A call to a simple Scheme function.
>>>     (define (foo port) 42)
>>>     (let ((port (open-input-string "s"))) (do-times #e1e7 (foo port)))
>>>
>>>     ;; 3. A call to a port subr.
>>>     (let ((port (open-input-string "s"))) (do-times #e1e7 (port-line port)))
>>>
>>>     ;; 4. A call to a port subr that touches the buffer.
>>>     (let ((port (open-input-string "s"))) (do-times #e1e7 (peek-char port)))
>>>
>>> The results:
>>>
>>>                       | baseline | foo    | port-line | peek-char
>>>     ------------------+----------+--------+-----------+----------
>>>     guile 2.0         | 0.269s   | 0.845s | 1.067s    | 1.280s
>>>     guile master      | 0.058s   | 0.224s | 0.225s    | 0.433s
>>>     wip-port-refactor | 0.058s   | 0.220s | 0.226s    | 0.375s
>>
>> Oh, nice!  (By “prohibitively slow” I was referring to 2.0.)
>>
>> For ‘peek-char’, isn’t there also the fact that string ports in 2.2 are
>> UTF-8 by default, so we get the fast path, whereas in 2.0 there
>> ‘%default-port-encoding’, which could be something else leading to the
>> slow path?
>
> I tried making sure the string port was a UTF-8 port but that made no
> difference to the 2.0 peek-char times.  I suspect this is because I ran
> it at the REPL, which had done a setlocale() already.  But perhaps
> that's not the right explanation.

It’s definitely the case if you use a UTF-8 locale.

Thanks for checking!

Ludo’.



reply via email to

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