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

Best way to convert integer to string?



I'm updating counters as a periodic task on a window while playing a 
MIDI sequence. From time to time the counters will freeze. I'm using princ-to-string to convert the counter values to strings before printing 
with #_DrawString. I'm suspecting that freezing is caused by ephemeral 
garbage collection, and endeed when I test princ-to-string it makes lots of garbage:

(time (dotimes (i 1000) (princ-to-string 123)))

(dotimes (i 1000) (princ-to-string 123)) took 1696 milliseconds (1.696 seconds) to run.
Of that, 24 milliseconds (0.024 seconds) were spent in The Cooperative Multitasking Experience.
 96000 bytes of memory allocated.

Is there a better way to print integers?

Peter
psto@xs4all.nl