emacs-devel
[Top][All Lists]
Advanced

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

Re: using empty_string as the only "" string


From: dmantipov
Subject: Re: using empty_string as the only "" string
Date: Wed, 25 Apr 2007 09:38:15 +0400 (MSD)

That was an interesting discussion, thanks to all.

All CLs I've installed (clisp, cmucl and franz) gives (eq 0 0) => t and
(eq "" "") => nil. But a) we can tweak 'eq' to handle this special case
(looks poor, but just to purify the language) and b) Emacs isn't a CL
and should not obey CLtL2 completely, isn't it ?

Immediately after startup but before any user interaction, my emacs
binary creates >260 empty strings, and >60 of them survives the first GC.
Saving 960 bytes (on 32-bit system) of Lisp_Strings may be considered
marginal. But, for example, after you have gnus loaded, you will have
>1000 empty strings created, and >600 of them survives the next GC.
I don't agree that approx. 10K is a marginal space optimization even
if your desktop has 4G RAM.

Immediate (built into Lisp_String) short strings is a nice and
interesting idea too, IMHO.

I don't expect too much from the canonicalization of another objects,
'frequently-used' float numbers like 1.0 or 0.0 in particular. I believe
these objects are very rare (in comparison with empty strings) in the most
common situations, so it will be just 0.0001% over no-op.

> You can modify the multibyteness of an empty string, and a
> unibyte empty string and a multibyte empty string behave a
> little bit differently, for instance, when concatinated with
> an unibyte 8-bit string.

How you can modify the multibyteness of an empty string ? You can't aset
multibyte char (as well as anything else) into empty string, and conversion
functions like 'string-make-unibyte' or 'string-to-multibyte' always creates
new strings instead of touching an argument. Moreover, since "" is a
no-op in concatenation operations, it may be silently discarded without
looking into internal structure, isn't it ?

Dmitry




reply via email to

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