On 8/8/07, Richard Blewett <[EMAIL PROTECTED]> wrote:
>
>
> unless you think we should special case the known primitives (there
> is some code in place special casing situations like boxing Nullable<T>).
> Then we come back to Fabian's point - assuming you have a shared boxed
> int,
> how long do you expect to keep this shared int around? If not forever
> (which
> is possible if you think about the behaviour of interned strings) then you
> have just created a bunch of gen2 garbage that the GC will have to work
> very
> hard to collect.


I seem to recall that CPython keeps a predefined collection of small integer
objects so that they don't have to be constructed from scratch.  It might be
effective for the JITter to similarly keep a permanent but small set of
integers -- say, from -1 to 255 -- so that boxing an integer in this range
is just a simple index operation.  On the other hand, I don't think I'd
bother implementing something like this without extensive profiling that
suggests the performace is worth the increased complexity.

--
Curt Hagenlocher
[EMAIL PROTECTED]

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to