fog / fog-google

Fog for Google Cloud Platform
MIT License
98 stars 146 forks source link

improve perf for default_signer: Don't create new PKey::RSA if we already can sign #591

Closed yosiat closed 1 year ago

yosiat commented 1 year ago

As of today we creating new OpenSSL::PKey::RSA when we sign, even if the existing signing_key is already a OpenSSL::PKey::RSA.

In google ruby gem they are doing the same approach - https://github.com/googleapis/google-cloud-ruby/blob/main/google-cloud-storage/lib/google/cloud/storage/file/signer_v2.rb#L137

Warming up --------------------------------------
                sign   119.000  i/100ms
                 new   179.000  i/100ms
Calculating -------------------------------------
                sign      1.199k (± 0.7%) i/s -      6.069k in   5.063095s
                 new      1.791k (± 0.6%) i/s -      9.129k in   5.096376s

Comparison:
                 new:     1791.3 i/s
                sign:     1198.7 i/s - 1.49x  slower

source: https://gist.github.com/yosiat/372bc468d23c568cd8722af7f56a2b03

korichdaniel commented 1 year ago

@geemus Can you review this PR? Thank you.

geemus commented 1 year ago

Thanks!

geemus commented 1 year ago

Released in v1.20.0.