Skip to content

Instantly share code, notes, and snippets.

@tadejm
Last active October 29, 2016 20:29
Show Gist options
  • Save tadejm/fe93a04bd97a4fa26f11a4484eab9bf7 to your computer and use it in GitHub Desktop.
Save tadejm/fe93a04bd97a4fa26f11a4484eab9bf7 to your computer and use it in GitHub Desktop.
fetch & collect cpu benchmarks
# frozen_string_literal: true
source "https://rubygems.org"
gem "oga"
gem "pry"
require "bundler"
Bundler.setup
require 'oga'
require 'net/http'
require "pry"
require "csv"
urls = {
"6360U" => "http://www.cpu-monkey.com/en/cpu-intel_core_i5_6360u-581",
"6660U" => "http://www.cpu-monkey.com/en/cpu-intel_core_i7_6600u-587",
"6267U" => "http://www.cpu-monkey.com/en/cpu-intel_core_i5_6267u-584",
"6287U" => "http://www.cpu-monkey.com/en/cpu-intel_core_i5_6287u-583",
"6567U" => "http://www.cpu-monkey.com/en/cpu-intel_core_i7_6567u-586",
"6700HQ" => "http://www.cpu-monkey.com/en/cpu-intel_core_i7_6700hq-573",
"6920HQ" => "http://www.cpu-monkey.com/en/cpu-intel_core_i7_6920hq-570",
"4558U" => "http://www.cpu-monkey.com/en/cpu-intel_core_i7_4558u-299",
"4258U" =>"http://www.cpu-monkey.com/en/cpu-intel_core_i5_4258u-242",
}
CSV.open("./results.csv", "wb") do |csv|
urls.each_pair do |cpu_model, url|
body = Net::HTTP.get URI.parse(url)
document = Oga.parse_html(body)
results = (1..8).map do |bench_id|
css_selector = "#bench_#{bench_id} table .benchmarkbar_active"
document.at_css(css_selector).text rescue nil
end
results << cpu_model
csv << results
end
end
2.94 1.48 3780 3251 5690 131 268 6360U
3.55 1.64 32.3 4657 3600 6923 144 323 6660U
3.69 1.59 4735 3481 7128 140 336 6267U
3.93 1.69 5042 3692 7590 149 357 6287U
3.62 1.74 4739 3826 7045 153 329 6567U
7.31 1.7 32.7 7975 3694 13212 148 672 6700HQ
8.03 1.84 32.7 8757 4012 14506 161 738 6920HQ
3.45 1.44 22.3 4749 3070 6273 129 314 4558U
3.02 1.31 20.7 3893 2690 5594 116 263 4258U
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment