Closed GoogleCodeExporter closed 9 years ago
Whoops, there is a small typo in my comment code. The patch is correct, though.
Original comment by james.r...@gmail.com
on 8 Apr 2010 at 4:14
Original comment by kurt.kluever
on 8 Apr 2010 at 8:10
James, I'm sorry ImmutableMap is unusable to you.
We will microbenchmark the performance of this method, and improve it as much
as we
can, however there is really no other reliable way to get the data out of a
Map, in
the general case, than toArray(). We added this in response to real live
production
bugs in Google Wave servers, which were copying the contents of a
MapMaker-created
map, which is concurrently being modified by the GC thread while the copy is
happening.
Martin Buchholz and I discussed the toArray() approach in great detail and are
both
convinced it's the right one.
<pedantic> btw, don't confuse the term "profiling" with "microbenchmarking"
(http://code.google.com/p/caliper/wiki/JavaMicrobenchmarks); tell me you have
ImmutableMap.copyOf() as a hot spot in bona find "profiling" of your production
service, and that's a much more significant finding.
Original comment by kevinb@google.com
on 9 Apr 2010 at 7:03
This is from analyzing a real application - albeit in a simulated environment,
so perhaps that qualifies for the
definition of a microbenchmark. Also, toArray is a pretty well known
performance problem in the java library
when using an empty array - but of course it's hard to quantify this, and it
depends from application to
application.
After taking a look at MapMaker, I can see why you did it this way. Perhaps for
the common use case of
HashMaps you could use size() like it originally did.
It's up to you guys. For now, I'll stick with my wrapped hash maps. My main
motivation here is to improve this
awesome library.
Original comment by james.r...@gmail.com
on 9 Apr 2010 at 10:23
I take that back - HashMaps won't work either. If there is any concurrent
modification of the hash map, same
problem. Moving on...
Original comment by james.r...@gmail.com
on 9 Apr 2010 at 10:52
Original comment by kevinb@google.com
on 23 Apr 2010 at 6:30
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:15
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:10
Original issue reported on code.google.com by
james.r...@gmail.com
on 8 Apr 2010 at 4:12Attachments: