thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Meyer <joel.me...@gmail.com>
Subject Re: Autoboxing in generated java code
Date Thu, 16 Jul 2009 00:22:44 GMT
On Wed, Jul 15, 2009 at 5:09 PM, Ted Dunning <ted.dunning@gmail.com> wrote:

> That last answer in the comment chain just asserts that this is the cost of
> autoboxing.  It doesn't actually describe any measurements.
>
> I think that is a made-up number.  I find it very hard to imagine that it
> costs hundreds of microseconds to box or unbox an integer (0.5 s / 2000).


I would imagine that the cost of boxing a primitive value is roughly
equivalent to the time it takes to allocate and initialize its Object
equivalent. The cost of unboxing should be roughly equal to the time of a
method invocation (myObject.getPrimitiveValue()).

I don't see why manually allocating the object yourself (instead of having
the JVM do it) would be any faster (especially if the JVM caches frequently
boxed values), but maybe I'm missing something?


>
>
> On Wed, Jul 15, 2009 at 4:51 PM, Bryan Duxbury <bryan@rapleaf.com> wrote:
>
> > there is some cost for sure but I did not do a real benchmark. When I did
> >> search for it, I came across :
> >> http://stackoverflow.com/questions/423704/java-int-or-integer/423856
> >>
> >> the last answer indicate that auboxing 2000 Integer add 0.5 ms... yes
> it's
> >> not much but if you are doing a lot of such operation it starts to adds
> up
> >> especially on a server side web apps/web services.
> >>
> >
> > Interesting. Would love to see if that measured up the same way in
> Thrift.
>
>
>
>
> --
> Ted Dunning, CTO
> DeepDyve
>
> 111 West Evelyn Ave. Ste. 202
> Sunnyvale, CA 94086
> http://www.deepdyve.com
> 858-414-0013 (m)
> 408-773-0220 (fax)
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message