[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (INCF Variable <float>) creates garbage!?
- To: Repenning Alexander <ralex@tigger.cs.colorado.edu>
- Subject: Re: (INCF Variable <float>) creates garbage!?
- From: kab (Kim Barrett)
- Date: Thu, 11 Feb 93 18:11:22
- Cc: info-macl@cambridge.apple.com
> I' have big loops incrementing floats. These loops create quite some
> garbage since incrementing a variable with a float apparently creates
> garbage (in MCL2.0p2):
>
> (defvar V 0)
>
> (time (incf V 1.5))
>
> ...8 bytes of memory allocated.
>
> Is there no way arround this? Intuitively I'd think INCF should be
> able to increment floats without producing any garbage (e.g., better
> boxing?).
I'd say 8 bytes is pretty good, since that's the size of the double float object
it has to cons up as the new value. incf is *not* a destructive operation, and
does not bash the old value (who knows who else might be pointing at that 0.0,
expecting it to remain zerop).