Skip to content

Commit

Permalink
Merge pull request #204 from bensheldon/benchmarks
Browse files Browse the repository at this point in the history
Add scripts directory for benchmarking and dev tasks
  • Loading branch information
bensheldon authored Jan 22, 2021
2 parents 1fafc13 + 52cd3e4 commit 91dfd10
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ gem 'activerecord-jdbcpostgresql-adapter', platforms: [:jruby]
gem 'pg', platforms: [:mri, :mingw, :x64_mingw]

platforms :ruby do
gem "memory_profiler"
gem "pry-byebug"
gem "rbtrace"

group :lint do
Expand Down
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ GEM
parser (>= 2.4)
smart_properties
builder (3.2.4)
byebug (11.1.3)
capybara (3.34.0)
addressable
mini_mime (>= 0.1.3)
Expand Down Expand Up @@ -123,6 +124,7 @@ GEM
mixlib-cli (~> 2.1, >= 2.1.1)
mixlib-config (>= 2.2.1, < 4)
mixlib-shellout
memory_profiler (1.0.0)
method_source (1.0.0)
mini_mime (1.0.2)
mini_portile2 (2.5.0)
Expand Down Expand Up @@ -157,6 +159,9 @@ GEM
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (4.0.6)
Expand Down Expand Up @@ -271,7 +276,9 @@ DEPENDENCIES
kramdown
kramdown-parser-gfm
mdl
memory_profiler
pg
pry-byebug
pry-rails
puma
rbtrace
Expand Down
23 changes: 23 additions & 0 deletions scripts/benchmark_scheduler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# $ bundle exec ruby scripts/benchmark_scheduler.rb
#
require 'memory_profiler'
require_relative '../lib/good_job'

class Performer
def name
''
end

def next
sleep 0.1
end
end

scheduler = GoodJob::Scheduler.new(Performer.new, max_threads: 5)

report = MemoryProfiler.report do
10_000.times { scheduler.create_thread }
end

report.pretty_print

0 comments on commit 91dfd10

Please sign in to comment.