GNU bug report logs -
#62009
29.0.60; Emacs crashes on setf symbol-name
Previous Next
Full log
View this message in rfc822 format
On 3/10/23 11:59, Gregory Heytings wrote:
> Is "symbol-name" a function that is used in performance-critical code?
> And did you actually measure that performance overhead before concluding
> that it it "unacceptably large"? According to my measurements, creating a
> string from a symbol name costs about 100 CPU cycles.
Yes, of course, for example completion. It would add cost all over the
place in many packages. Also note the added GC pressure. It is not a
good idea to change symbol-name now to allocate strings.
>> Raising an exception upon modification would be the best approach.
>>
>
> That would also come with a performance overhead, as there is currently no
> way to distinguist strings that are used for symbol names from other
> strings. Not to mention the added complexity in the code.
One could check if the string is located in read-only memory. Or one
could add a flag bit to the string data structure (and possibly to other
data structures too). Freezing data structures such that they become
read-only is a generally useful feature. There won't be any performance
overhead of the check since a branch not taken is fast thanks to the
branch predictor.
Daniel
This bug report was last modified 2 years and 89 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.