guile-user
[Top][All Lists]
Advanced

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

Re: string vs list processing


From: Michael Livshin
Subject: Re: string vs list processing
Date: 16 Apr 2001 17:59:15 +0300
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Crater Lake)

address@hidden (Harvey J. Stein) writes:

> That (string-ref str 0) takes about the same time as (list-ref lst 0)
> is good.  The string ref is checking arguments, indexing into the
> array & returning a char.  The list-ref is checking arguments &
> dereferencing car of lst.  Actually, I'm a little surprised that
> (string-ref ...) isn't slower.

??? string-ref is of constant complexity, whereas list-ref is of
linear complexity.

shouldn't matter with sizes <100, but certainly should matter in
general.

> Doesn't the string-ref have to malloc
> to create the character that it's returning, whereas the list-ref
> doesn't?

no, Guile chars are immediate.

-- 
The only thing better than TV with the sound off is Radio with the sound
off.
                -- Dave Moon




reply via email to

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