Skip to content

Instantly share code, notes, and snippets.

@trishume
Created July 18, 2017 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trishume/cfe62cd3c247af51d1e0080db4725021 to your computer and use it in GitHub Desktop.
Save trishume/cfe62cd3c247af51d1e0080db4725021 to your computer and use it in GitHub Desktop.
CPU load tester for Sublime
# 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