mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 23:59:40 +02:00
perf(transactions): add kind
to Transaction
model and remove expensive Transfer joins in aggregations (#2388)
* add kind to transaction model * Basic transfer creator * Fix method naming conflict * Creator form pattern * Remove stale methods * Tweak migration * Remove BaseQuery, write entire query in each class for clarity * Query optimizations * Remove unused exchange rate query lines * Remove temporary cache-warming strategy * Fix test * Update transaction search * Decouple transactions endpoint from IncomeStatement * Clean up transactions controller * Update cursor rules * Cleanup comments, logic in search * Fix totals logic on transactions view * Fix pagination * Optimize search totals query * Default to last 30 days on transactions page if no filters * Decouple transactions list from transfer details * Revert transfer route * Migration reset * Bundle update * Fix matching logic, tests * Remove unused code
This commit is contained in:
parent
7aca5a2277
commit
1aae00f586
49 changed files with 1749 additions and 705 deletions
|
@ -6,6 +6,37 @@
|
|||
# 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 "Benchmark specific code"
|
||||
task code: :environment do
|
||||
Benchmark.ips do |x|
|
||||
x.config(time: 30, warmup: 10)
|
||||
|
||||
family = User.find_by(email: "user@maybe.local").family
|
||||
scope = family.transactions.active
|
||||
|
||||
# x.report("IncomeStatement::Totals") do
|
||||
# IncomeStatement::Totals.new(family, transactions_scope: scope).call
|
||||
# end
|
||||
|
||||
# x.report("IncomeStatement::CategoryStats") do
|
||||
# IncomeStatement::CategoryStats.new(family).call
|
||||
# end
|
||||
|
||||
# x.report("IncomeStatement::FamilyStats") do
|
||||
# IncomeStatement::FamilyStats.new(family).call
|
||||
# end
|
||||
|
||||
puts family.entries.count
|
||||
|
||||
x.report("Transaction::Totals") do
|
||||
search = Transaction::Search.new(family)
|
||||
search.totals
|
||||
end
|
||||
|
||||
x.compare!
|
||||
end
|
||||
end
|
||||
|
||||
desc "Shorthand task for running warm/cold benchmark"
|
||||
task endpoint: :environment do
|
||||
system(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue