Interning symbols can be costly
Openopened 6 months ago by mnw · 1 comments
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Users should be discouraged from creating intermediate symbol values.
In a multi-threaded implementation with a global symbol table, interning symbols will most likely have a locking overhead.
String operations can be implemented much cheaper. Only string comparison (in case of equality) is costly (when compared to symbols).
Hello Marc. Thank you very much for joining up!
Good point. Draft 1 has only these two procedures that return symbols:
and these encourage users to batch up many intermediate operations into a single procedure call.
symbol-appendconcatenates any number of strings, and things that are converted into strings, and only makes one symbol at the very end.
string-procwhich does an arbitrarily complex operation on a string.
In general, making new symbols is useful in macros and specialized kinds of I/O, which tend not to be performance sensitive.