pplu / aws-sdk-perl

A community AWS SDK for Perl Programmers
Other
170 stars 94 forks source link

Moo conversion - speedier Paws #348

Open castaway opened 4 years ago

castaway commented 4 years ago

Hi @pplu , Shadowcat has been sponsored to convert Paws to Moo, so I did. Have a look at https://github.com/shadow-dot-cat/aws-sdk-perl/tree/feature/mooification and let us know what you think.

Jess

shadowcat-mst commented 4 years ago

Note that we solved the "omg how much meta access" problem by generating out data structures into a static class method, because, well, we already had the information in the templates anyway. Makes it much much simpler but preserves the structure.

pplu commented 4 years ago

This looks awesome. 🎉 🎈

@shadowcat-mst It looks a lot like the concepts I was playing with in other HTTP-API modules to not depend on Moose like: https://github.com/pplu/kubernetes-rest/blob/master/auto-lib/Kubernetes/REST/Call/v2beta1/Autoscaling/ListHorizontalPodAutoscalerForAllNamespaces.pm so I

@castaway : So much thanks for your work. Let me play with it a bit and try stuff out

pplu commented 4 years ago

Hi,

in t/13_client_connect_errors.t we have:

# Default caller
ok 1 - got exception
ok 2 - Correct code ConnectionError code
# LWP caller
ok 3 - got exception
ok 4 - Correct code ConnectionError code
# Mojo caller
# coercion for "config" failed: coercion for "caller" failed: Invalid isa 'Mojo::UserAgent' for Paws::Net::MojoAsyncCaller->ua is not a coderef or code-convertible object at lib/Paws/Net/MojoAsyncCaller.pm line 14.
# Compilation failed in require at /home/devel/src/shadowcat-paws/local/lib/perl5/Module/Runtime.pm line 314.
# Furl caller
ok 5 - got exception
ok 6 - Correct code ConnectionError code
1..6

which is passing, but this is definetly a false pass from the Mooification

aeruder commented 4 years ago

Just to emphasize the added awesomeness of this pull request -- In addition to just a straight Moose -> Moo transition, this PR also drastically improves the decoding logic / caching. Just to add some raw numbers on the speed improvements (tldr; > 5x)

old:
a@work ~paws/benchmarks -:a34ce7bd9:0.1G:INS % perl -I../Paws-0.40-slow/lib ./decode-benchmark
timethis 10: 38.3982 wallclock secs ( 0.00 usr  0.00 sys + 37.95 cusr  0.36 csys = 38.31 CPU) @  0.26/s (n=10)

new:
a@work ~paws/benchmarks -:a34ce7bd9:0.1G:INS % perl -I../lib -I../auto-lib ./decode-benchmark
timethis 10: 7.31231 wallclock secs ( 0.00 usr  0.00 sys +  6.92 cusr  0.32 csys =  7.24 CPU) @  1.38/s (n=10)

I'm happy to submit the benchmarks and profiling stuff as a separate PR (which is focusing on dynamodb decode speeds without hitting the network or requiring AWS accounts).

castaway commented 4 years ago

Hi,

in t/13_client_connect_errors.t we have:

# Default caller
ok 1 - got exception
ok 2 - Correct code ConnectionError code
# LWP caller
ok 3 - got exception
ok 4 - Correct code ConnectionError code
# Mojo caller
# coercion for "config" failed: coercion for "caller" failed: Invalid isa 'Mojo::UserAgent' for Paws::Net::MojoAsyncCaller->ua is not a coderef or code-convertible object at lib/Paws/Net/MojoAsyncCaller.pm line 14.
# Compilation failed in require at /home/devel/src/shadowcat-paws/local/lib/perl5/Module/Runtime.pm line 314.
# Furl caller
ok 5 - got exception
ok 6 - Correct code ConnectionError code
1..6

which is passing, but this is definetly a false pass from the Mooification

Thanks, I'll poke it (I did this then was promptly ill for a while..)

castaway commented 4 years ago

@pplu, I've just updated the MojoAsyncCaller, now it passes without those issues.

pplu commented 4 years ago

@castaway : Great! It looks like the Mooification was branched off some while ago. Could you merge pplu/master into the mooification?

castaway commented 4 years ago

hi @pplu, Ive merged in release/0.42, hoping that was the branch you meant, since I remembered the next release? Let me know if master is any different

akiym commented 3 years ago

Any update on this?