Created
July 18, 2017 19:31
-
-
Save trishume/cfe62cd3c247af51d1e0080db4725021 to your computer and use it in GitHub Desktop.
CPU load tester for Sublime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sublime load test for https://github.com/SublimeTextIssues/Core/issues/1820 | |
# On my 15" 2016 rMBP: | |
# 4 is not noticeable | |
# 8 is noticeable and just barely keeps up with typing | |
# 20 lags way behind my typing | |
NUM_PROCS = 20 | |
def compute_things() | |
sum = 0 | |
10_000.times do |i| | |
(0..6).to_a.permutation do |p| | |
sum += p.map { |e| e.to_f }.inject(:+) | |
end | |
print "." if i % 100 == 0 | |
end | |
puts sum | |
end | |
(NUM_PROCS-1).times do | |
fork { compute_things() } | |
end | |
compute_things() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment