mperham / connection_pool

Generic connection pooling for Ruby
MIT License
1.63k stars 143 forks source link

[WIP] Add connection pool wrap vs with benchmark #141

Closed ysv closed 2 years ago

ysv commented 3 years ago

Related to https://github.com/mperham/connection_pool/issues/120

Benchmark results On my machine (OSX 10.15.7 on 2,2 GHz 6-Core Intel Core i7) image

image

Conclusion using wrap is ~7% slower than block variant with with method. As for me it doesn't have high impact on performance but still worth mentioning.

If you agree with benchmark results and my conclusion I will add the point in the readme NOTES section

ysv commented 3 years ago

@mperham Could you please comment on this ?

mperham commented 3 years ago

Great info to have, thanks. Please don’t touch the gemspec, use stdlib only.

mperham commented 3 years ago

Can you fix the gemspec so I can merge?

ysv commented 3 years ago

Sure I will finalize withing the next week

BuonOmo commented 3 years ago

@mperham out of curiosity, what drawback do you see on adding a lib with add_development_dependency in a gemspec ?

mperham commented 3 years ago

It's code for one example benchmark. That's not important enough to justify entry in the gemspec. I think it should look more like:

begin
  gem "benchmark-ips"
  require "benchmark/ips"
rescue LoadError
  puts "Please run `gem install benchmark-ips` before running benchmarks"
end