I determined the issue was in the ID reclamation with the line:
CPAN::Forum
Object-InsideOut - Re: significant OIO overhead with thousands of objects
| Posted on Tue Feb 19 20:13:29 2008 by arguile in response to 7136 (See the whole thread of 13) |
| Re: significant OIO overhead with thousands of objects |
|
I determined the issue was in the ID reclamation with the line:
if ((my $id) = keys(%{$$reuse{$tree}[$thread_id]})) {
For a large number of objects this builds the entire array of IDs and grabs the first. If it's instead changed to:
keys(%{$$reuse{$tree}[$thread_id]}); # Reset hash iterator.
if ((my $id) = each %{$$reuse{$tree}[$thread_id]}) {
We see the exact same IDs (each() gives keys/values in the same order as keys()) but without any of the list building overhead. This changes the profiling in the previous post to:
Init Cache: 0.000521898 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
Retrival attempt:
0 :
GET: 3.04518 wallclock secs ( 2.88 usr + 0.05 sys = 2.93 CPU)
CLEAN: 0.791305 wallclock secs ( 0.72 usr + 0.00 sys = 0.72 CPU)
1 :
GET: 3.47432 wallclock secs ( 3.31 usr + 0.01 sys = 3.32 CPU)
CLEAN: 0.738527 wallclock secs ( 0.73 usr + 0.00 sys = 0.73 CPU)
2 :
GET: 3.59346 wallclock secs ( 3.36 usr + 0.02 sys = 3.38 CPU)
CLEAN: 0.755293 wallclock secs ( 0.76 usr + 0.00 sys = 0.76 CPU)
The diff:
683c683,685
< if ((my $id) = keys(%{$$reuse{$tree}[$thread_id]})) {
---
> keys(%{$$reuse{$tree}[$thread_id]}); # Reset hash iterator.
>
> if ((my $id) = each %{$$reuse{$tree}[$thread_id]}) {
|
| Direct Responses: 7138 | Write a response |
(2)
]