Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Performance of Elastic::Model::UID::new_from_store re Moose type constraints #21

Closed
timbunce opened this Issue Nov 12, 2012 · 1 comment

Comments

Projects
None yet
2 participants

On my system (perl 5.10) each call to Elastic::Model::UID::new_from_store takes 1.36ms.

That adds up fast.

Much of the cost is in Moose::Meta::TypeConstraint checking.

I see the Elastic::Model::UID doesn't use PACKAGE->meta->make_immutable;
That may help (here and in other packages).

Also, perhaps you'd consider dropping the Str and/or Maybe[Str] 'isa' declarations since they add relatively little value.

Owner

clintongormley commented Nov 14, 2012

Hiya @timbunce

The UID object creation time has been halved by making the class immutable. Also, i've added some optimization when creating new stub doc objects, so retrieving docs from elasticsearch performs a lot better than it did.

Released in v0.18 - https://metacpan.org/release/DRTECH/Elastic-Model-0.18/

I didn't remove the type constraints on routing etc, as there are quite a few users creating their own UID objects, and I'd prefer to make it easy to spot problems early. Although I could be persuaded.

Next stop is inlining the inflation/deflation process which will be a big performance gain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment