-
Notifications
You must be signed in to change notification settings - Fork 44
Compare benchmarks on commits graph #199
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
Compare benchmarks on commits graph #199
Conversation
d428644
to
f268109
Compare
7e927ab
to
d342f82
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work Marko ! 👏
app/assets/javascripts/initialize.js
Outdated
var benchmarkRunDisplayCount = $('#benchmark_run_display_count').val(); | ||
var compareWithBenchmark = $('#benchmark_run_compare_with').val(); | ||
|
||
if(compareWithBenchmark){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty nit-picky but maybe you could add surrounding spaces around braces.
switch(e.which) { | ||
case 37: //left | ||
optionIndex = incrementOptionIndex(optionIndex, optsLength, -1); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also nit-picky but it seems more idiomatic to align the break
with the block's content in JavaScript.
app/services/chart_builder.rb
Outdated
@categories << version if version != @categories.last | ||
if @comparing_runs.present? | ||
(@benchmark_runs + @comparing_runs) | ||
.sort_by{ |benchmark_run| benchmark_run.initiator.created_at } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @tgxworld suggested earlier, you could indent this by a level.
Also, to be honest I didn't test it but there should be a way to make this method a little bit easier to read. What do you think about something like:
def build_columns
columns = {}
if @comparing_runs.present?
runs = (@benchmark_runs + @comparing_runs)
.sort_by { |run| run.initiator.created_at }
else
runs = @benchmark_runs
end
runs.each do |run|
version = nil
if block_given?
version = yield(run)
@categories ||= []
@categories << version if version != @categories.last
end
run.result.each do |key, value|
if @comparing_runs.present?
columns["#{key}_#{run.benchmark_type.category}"] ||= []
columns["#{key}_#{run.benchmark_type.category}"] << [version, value.to_f]
else
columns[key] ||= []
columns[key] << value.to_f
end
end
end
@columns = columns.map do |name, data|
{ name: name, data: data}
end
self
end
sure @SamSaffron, I'm on it. |
a01f6ba
to
a1ee0af
Compare
57b992e
to
3384478
Compare
3384478
to
7670006
Compare
Thanks @robin850 :) I've made changes you've suggested. |
@bmarkons : No problem, good job. Does the timeout change is related to the refactoring of the |
@robin850 : No, that change doesn't affect performance. The code I've written in this PR is pretty much inefficient but I plan to make it better in next iteration. |
Okay great, this can be shipped then ! 🙂 🎉 |
New feature: Compare graphs for two different benchmarks.
Take a closer look at discussion.