[racket] datum-intern-literal and lists?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Mon Jun 25 17:05:48 EDT 2012

On Mon, Jun 25, 2012 at 4:00 PM, Danny Yoo <dyoo at hashcollision.org> wrote:
>> But one note: in the common case, it looks like your code will copy all of
>> the strings:
>>
>>> (define x "abc")
>>> (substring x 0)
>> "abc"
>>> (eq? x (substring x 0))
>> #f
>>
>> I guess these strings are not mutated, so you can probably avoid that in the
>> start = 0 case (something I see the original code does).
>
>
> Ah, thank you!  I'll incorporate this fix into the pull request I'll
> make this evening.  It'll include:
>
>    https://github.com/dyoo/racket/commit/dc88d00ad99ba3f9f3323445723a0c9535e716ef
>
> The interning still doesn't match my intuition: I would have expected
> the resulting strings after decoding to be unique enough as to have
> the interning be ineffective in reducing on-line memory usage.  I
> guess I should measure this sometime.

I think probably 20-25% of the strings are "\n", but probably the
interning is there also to avoid bugs since strings are generally
interned these days.

But as to measurements, what were you running that led you to try to
optimize this function?

Robby


Posted on the users mailing list.