mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +02:00
perf(income statement): cache income statement queries (#2371)
* Leftover cleanup from prior PR * Benchmark convenience task * Change default warm benchmark time * Cache income statement queries * Fix private method access
This commit is contained in:
parent
84b2426e54
commit
a5f1677f60
6 changed files with 103 additions and 77 deletions
|
@ -6,9 +6,16 @@
|
|||
# 4. Run locally, find endpoint needed
|
||||
# 5. Run an endpoint, example: `ENDPOINT=/budgets/jun-2025/budget_categories/245637cb-129f-4612-b0a8-1de57559372b RAILS_ENV=production BENCHMARKING_ENABLED=true RAILS_LOG_LEVEL=debug rake benchmarking:ips`
|
||||
namespace :benchmarking do
|
||||
desc "Shorthand task for running warm/cold benchmark"
|
||||
task endpoint: :environment do
|
||||
system(
|
||||
"RAILS_ENV=production BENCHMARKING_ENABLED=true ENDPOINT=#{ENV.fetch("ENDPOINT", "/")} rake benchmarking:warm_cold_endpoint_ips"
|
||||
)
|
||||
end
|
||||
|
||||
# When to use: Track overall endpoint speed improvements over time (recommended, most practical test)
|
||||
desc "Run cold & warm performance benchmarks and append to history"
|
||||
task ips: :environment do
|
||||
task warm_cold_endpoint_ips: :environment do
|
||||
path = ENV.fetch("ENDPOINT", "/")
|
||||
|
||||
# 🚫 Fail fast unless the benchmark is run in production mode
|
||||
|
@ -23,7 +30,7 @@ namespace :benchmarking do
|
|||
cold_iterations = Integer(ENV.fetch("COLD_ITERATIONS", 1)) # requests to measure for the cold run
|
||||
|
||||
warm_warmup = Integer(ENV.fetch("WARM_WARMUP", 5)) # seconds benchmark-ips uses to stabilise JIT/caches
|
||||
warm_time = Integer(ENV.fetch("WARM_TIME", 30)) # seconds benchmark-ips samples for warm statistics
|
||||
warm_time = Integer(ENV.fetch("WARM_TIME", 10)) # seconds benchmark-ips samples for warm statistics
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
setup_benchmark_env(path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue