[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Best way to convert integer to string?
- To: firstname.lastname@example.org
- Subject: Re: Best way to convert integer to string?
- From: tar@ISI.EDU (Thomas A. Russ)
- Date: 16 Feb 95 09:28:51
- Organization: USC-ISI
- References: <199502150824.AA26047@xs1.xs4all.nl>
- Reply-to: tar@ISI.EDU
- Sender: email@example.com
In article <...> firstname.lastname@example.org (Peter Stone) writes:
> 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:
> Is there a better way to print integers?
Two things to try looking at are:
with-output-to-string where you specify a string buffer to use.
format to a string output destination.
In both cases you will need to allocate a string with a fill pointer.
The output will then fill the string as necessary. It may take a little
experimentation to figure out if you need to reset the fill pointer of
if the output function does that for you. That way you will only have
to allocate the string once and keep it around for reuse. That will
eliminate the garbage associated with generating new strings each time.
Thomas A. Russ, USC/Information Sciences Institute email@example.com