Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scripts directory for benchmarking and dev tasks #204

Merged
merged 1 commit into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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