Object-InsideOut - Re: significant OIO overhead with thousands of objects

Posted on Tue Nov 20 23:09:33 2007 by jdhedden in response to 6475 (See the whole thread of 13)
Re: significant OIO overhead with thousands of objects
Well, I am not entirely surprised by the results. Object creation and destruction in OIO is expensive because of considerations for thread safety and reclamation of object IDs. (The latter keeps the arrays that store object data from continually growing when there is a lot of object turnover.) I'm hoping your tests using the lastest OIO version be better.

You mentioned Class::Std. My own testing shows it to be on a par with OIO as afar as object creation, but OIO is faster for data access. Because of the nature of inside-out objects, both are slower by an order of magnitude compared to standard blessed hashes.

One drawback to Class::Std that bears mentioning is that it doesn't support threads.

If your application can accommodate it, you could try a caching scheme to recycle old objects. Create an array to 'push' old objects onto, create a method to reinitialize an old object with new data, and use it like this:
# Reuse an old object if (my $obj = pop(@recycle_bin)) { return $obj->reinit($rh_ent); } # Create a new object return $class->new($rh_ent);
If you do feel compelled to switch, you might give consideration to Class::InsideOut. However, I can't speak to its performance.
Write a response