Interning symbols can be costly #1

Open
opened 2022-12-03 09:14:20 -05:00 by mnw · 1 comment

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).

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).
Owner

Hello Marc. Thank you very much for joining up!

Good point. Draft 1 has only these two procedures that return symbols:

(symbol-append object ...) -> symbol

(symbol-transform string-proc symbol arg ...) -> symbol

and these encourage users to batch up many intermediate operations into a single procedure call.

  • symbol-append concatenates any number of strings, and things that are converted into strings, and only makes one symbol at the very end.

  • symbol-transform calls string-proc which 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.

Hello Marc. Thank you very much for joining up! Good point. Draft 1 has only these two procedures that return symbols: ``` (symbol-append object ...) -> symbol (symbol-transform string-proc symbol arg ...) -> symbol ``` and these encourage users to batch up many intermediate operations into a single procedure call. * `symbol-append` concatenates any number of strings, and things that are converted into strings, and only makes one symbol at the very end. * `symbol-transform` calls `string-proc` which 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.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: review/2022-2#1
No description provided.