Skip to content

Commit

Permalink
Rename Performer => Reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzedge committed Jan 16, 2017
1 parent 9552a79 commit 60f4497
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 36 deletions.
6 changes: 3 additions & 3 deletions lib/rambling/trie/tasks/performance/benchmark.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require 'benchmark'
require_relative 'performer'
require_relative 'reporter'

module Performance
class Benchmark < Performance::Performer
class Benchmark < Performance::Reporter
def initialize filename = nil, output = $stdout.dup
@output = output
end

def do_perform iterations, params
def do_report iterations, params
params.each do |param|
output.print "#{iterations} iterations - #{param.to_s}".ljust 40

Expand Down
6 changes: 3 additions & 3 deletions lib/rambling/trie/tasks/performance/call_tree_profile.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require_relative 'performer'
require_relative 'reporter'

module Performance
class CallTreeProfile < Performance::Performer
class CallTreeProfile < Performance::Reporter
def initialize dirname
@dirname = dirname
end

def do_perform iterations, params
def do_report iterations, params
FileUtils.mkdir_p dirpath

result = RubyProf.profile merge_fibers: true do
Expand Down
6 changes: 3 additions & 3 deletions lib/rambling/trie/tasks/performance/compression_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ def name
'compression'
end

def execute performer_class
performer = performer_class.new name
def execute reporter_class
reporter = reporter_class.new name

tries = []
iterations.times { tries << Rambling::Trie.load(raw_trie_path) }

i = 0
performer.perform iterations do |trie|
reporter.report iterations do |trie|
tries[i].compress!
i += 1
nil
Expand Down
6 changes: 3 additions & 3 deletions lib/rambling/trie/tasks/performance/creation_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def name
'creation'
end

def execute performer_class
performer = performer_class.new name
performer.perform iterations, params do
def execute reporter_class
reporter = reporter_class.new name
reporter.report iterations, params do
Rambling::Trie.create dictionary; nil
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/rambling/trie/tasks/performance/flamegraph_profile.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require_relative 'performer'
require_relative 'reporter'

module Performance
class FlamegraphProfile < Performance::Performer
class FlamegraphProfile < Performance::Reporter
def initialize filename
@filename = filename
end

def do_perform iterations, params
def do_report iterations, params
FileUtils.mkdir_p dirpath

result = Flamegraph.generate filepath do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ def name
'lookups:partial_word'
end

def execute performer_class, trie
performer = performer_class.new filename trie
performer.perform iterations, params do |word|
def execute reporter_class, trie
reporter = reporter_class.new filename trie
reporter.report iterations, params do |word|
trie.partial_word? word
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/rambling/trie/tasks/performance/lookups_scan_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def name
'lookups:scan'
end

def execute performer_class, trie
performer = performer_class.new filename trie
def execute reporter_class, trie
reporter = reporter_class.new filename trie
params_to_iterations.each do |word, iterations|
performer.perform iterations, word.to_s do |word|
reporter.report iterations, word.to_s do |word|
trie.scan(word).size
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/rambling/trie/tasks/performance/lookups_word_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ def name
'lookups:word'
end

def execute performer_class, trie
performer = performer_class.new filename trie
performer.perform iterations, params do |word|
def execute reporter_class, trie
reporter = reporter_class.new filename trie
reporter.report iterations, params do |word|
trie.word? word
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/rambling/trie/tasks/performance/memory_profile.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require_relative 'performer'
require_relative 'reporter'

module Performance
class MemoryProfile < Performance::Performer
class MemoryProfile < Performance::Reporter
def initialize filename
@filename = filename
end

def do_perform iterations, params
def do_report iterations, params
FileUtils.mkdir_p dirpath

result = MemoryProfiler.report allow_files: 'lib/rambling/trie', ignore_files: 'lib/rambling/trie/tasks' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
require_relative '../helpers/trie'

module Performance
class Performer
class Reporter
include Helpers::GC
include Helpers::Path
include Helpers::Time

def perform iterations = 1, params = nil
def report iterations = 1, params = nil
params = Array params
params << nil unless params.any?

do_perform iterations, params do |param|
do_report iterations, params do |param|
yield param
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def name
'serialization:compressed'
end

def execute performer_class
performer = performer_class.new name
performer.perform iterations, params do
def execute reporter_class
reporter = reporter_class.new name
reporter.report iterations, params do
Rambling::Trie.load compressed_trie_path; nil
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/rambling/trie/tasks/performance/serialization_raw_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def name
'serialization:raw'
end

def execute performer_class
performer = performer_class.new filename
performer.perform iterations, params do
def execute reporter_class
reporter = reporter_class.new filename
reporter.report iterations, params do
Rambling::Trie.load raw_trie_path; nil
end
end
Expand Down

0 comments on commit 60f4497

Please sign in to comment.