mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Remove benchmark_stats.rb
This commit is contained in:
parent
bdcfb5eb62
commit
04a16029a4
1 changed files with 0 additions and 30 deletions
|
|
@ -1,30 +0,0 @@
|
|||
require 'benchmark'
|
||||
|
||||
# Test the optimized stats calculation
|
||||
data = Benchmark.measure do
|
||||
user_id = 7
|
||||
|
||||
last_calculated_at = DateTime.new(1970, 1, 1)
|
||||
|
||||
time_diff = last_calculated_at.to_i..Time.current.to_i
|
||||
timestamps = Point.where(user_id:, timestamp: time_diff).pluck(:timestamp).uniq
|
||||
|
||||
months = timestamps.group_by do |timestamp|
|
||||
time = Time.zone.at(timestamp)
|
||||
[time.year, time.month]
|
||||
end.keys
|
||||
|
||||
months.each do |year, month|
|
||||
Stats::CalculateMonth.new(user_id, year, month).call
|
||||
end
|
||||
end
|
||||
|
||||
puts "Stats calculation benchmark:"
|
||||
puts "User Time: #{data.utime}s"
|
||||
puts "System Time: #{data.stime}s"
|
||||
puts "Total Time: #{data.real}s"
|
||||
|
||||
# @real=28.869485000148416,
|
||||
# @stime=2.4980050000000027,
|
||||
# @total=20.303141999999976,
|
||||
# @utime=17.805136999999974>
|
||||
Loading…
Reference in a new issue