Hello,
I have a question about differences between deleting a symbol vs setting a symbol to nil.
When I do some housekeeping myself and want to get a unused symbol out of the (symbols) list,
I use (delete 'symbolname) to delete the content and the symbol itself.
What the difference between them in memory usage?
Is deleting and recreating a symbol the same performance as nil it an reused it later?
Regards
Hans-Peter
Ok, making this little benchmark:
Quote
> (time(dotimes (zCount 10000)(set(sym(string "TEST" zCount))10)))
140.625
> (time(dotimes (zCount 10000)(set(sym(string "TEST" zCount))10)(set(sym(string "TEST" zCount))nil)))
218.75
> (time(dotimes (zCount 10000)(set(sym(string "TEST" zCount))10)(delete(sym(string "TEST" zCount)))))
1046.875
Deleting the symbol seems to need more performance. But memory?
Hans-Peter
Deleting a symbol affects the symbol-tree and a check for reference from resident code or data is made. The memory usage of a symbol is very little with 28 bytes plus the name string on 32bit newLISP on Windows.