mirror of
https://github.com/Komediruzecki/token-circles.git
synced 2026-10-20 09:46:43 +02:00
* perf(frontend): O(N+M) import dedup, batched importExecute, single-pass budgets/stats
Optimize hot paths in the in-browser IndexedDB storage handlers. All four
rewrites are result-preserving (byte-for-byte identical outputs and balance
math); only the algorithmic complexity changes.
- detectDuplicates (importFlow.ts): was O(N*M + N^2) — a full existing-rows
find() per imported row plus a rows.filter(includes()) pass. Now builds a
Map keyed by (date, normalized-description) once, then a single pass over
imported rows. O(N+M). The amount tolerance (|a-b| < 0.01) is not an
equivalence relation, so it stays a real comparison, but only ever runs
against existing rows already sharing the exact (date, description) key —
identical to the original find(). Key parts are NUL-joined so the tuple can
never collide.
- importExecute (importFlow.ts): inserted rows one-by-one, each with an awaited
read-modify-write account-balance update. Now defers inserts + balance
updates into a single atomic IndexedDB transaction: O(N) inserts + O(A)
account writes. Balance deltas are replayed per-delta in exact row order
against a lazily-seeded in-memory cache, reproducing the previous sequential
float accumulation (b0, b0+d1, +d2, ...) exactly; each touched account is
written once. Transaction ids stay auto-incremented in insertion order, so
imported_ids is unchanged. Category auto-creation stays inline, preserving
category-id assignment order.
- budgetsForecast / budgetsHistory (budgets.ts): rescanned the full filtered
transaction list per budget row. Now precompute a single month-bucketed Map
in one pass and look up per budget. A budget window is
[start_date, endOfNextMonth(start_date)); for a 1st-of-month start_date that
is exactly the calendar month start_date.slice(0,7), so the bucket lookup is
identical. Any non-1st start_date falls back to the exact windowed reduce so
results never change. O(T + B).
- statsMonthly (analytics.ts): looped months x 3 full filter/reduce passes.
Now a single bucketing pass keyed by date.slice(0,7) (identical to the
original date.startsWith('YYYY-MM') check), then reads the requested window.
O(T + months).
Adds perf-optimizations.test.ts: regression guards asserting each rewrite's
output against hand-computed expected values, including the exact
sequential-float balance accumulation and the mid-month budget-window fallback.
Verification: tsc --noEmit clean; full vitest suite 317 passed (307 baseline +
10 new); eslint and prettier clean on the touched files.
* chore(release): 5.2.0 — CHANGELOG + frontend version bump
84 lines
2.8 KiB
JSON
84 lines
2.8 KiB
JSON
{
|
|
"name": "finance-manager-frontend",
|
|
"version": "5.2.0",
|
|
"type": "module",
|
|
"description": "Finance Manager Frontend - SolidJS + TypeScript",
|
|
"author": "Komediruzecki",
|
|
"license": "AGPL-3.0-only",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/Komediruzecki/finance-manager"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/Komediruzecki/finance-manager/issues"
|
|
},
|
|
"homepage": "https://github.com/Komediruzecki/finance-manager#readme",
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "vite build",
|
|
"build:dev": "vite build --mode dev",
|
|
"deploy:dev": "pnpm run build:dev && npx wrangler deploy --env dev",
|
|
"deploy:prod": "pnpm run build && npx wrangler deploy --env prod",
|
|
"tsc": "npx tsc",
|
|
"typecheck": "tsc --noEmit",
|
|
"vite": "npx vite",
|
|
"preview": "vite preview",
|
|
"lint": "eslint",
|
|
"lint:fix": "eslint --fix",
|
|
"format": "prettier --write . --ignore-path .prettierignore",
|
|
"fmt": "prettier . --write",
|
|
"cloc": "cloc src --exclude-dir=node_modules,dist --by-file-by-lang --not-match-f='(.*[.]d[.]ts|.*[.]stories[.].*|.*[.]test[.].*|.*[.]json)'",
|
|
"lines": "cloc src --exclude-dir=node_modules,dist --by-file-by-lang --not-match-f='(.*[.]d[.]ts|.*[.]stories[.].*|.*[.]test[.].*|.*[.]json)'",
|
|
"test": "vitest run",
|
|
"test:e2e": "playwright test",
|
|
"test:e2e:smoke": "playwright test --grep @smoke",
|
|
"test:unit": "vitest run",
|
|
"test:ui": "playwright test --ui",
|
|
"test:headed": "playwright test --headed",
|
|
"analyze-bundle": "VITE_ANALYZE_BUNDLE=true vite build"
|
|
},
|
|
"dependencies": {
|
|
"@types/d3": "^7.4.3",
|
|
"chart.js": "^4.5.1",
|
|
"clsx": "^2.1.1",
|
|
"d3": "^7.9.0",
|
|
"d3-sankey": "^0.12.3",
|
|
"idb": "^8.0.3",
|
|
"jspdf": "^4.2.1",
|
|
"solid-js": "^1.9.12",
|
|
"xlsx": "file:../vendor/xlsx-0.20.3.tgz",
|
|
"zod": "^4.4.3"
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "9.39.4",
|
|
"@playwright/test": "^1.59.1",
|
|
"@squoosh/lib": "^0.3.1",
|
|
"@types/d3-sankey": "^0.12.5",
|
|
"@types/node": "^22.10.5",
|
|
"@typescript-eslint/eslint-plugin": "8.58.2",
|
|
"@typescript-eslint/parser": "8.58.2",
|
|
"@vitest/coverage-v8": "^4.1.5",
|
|
"cloc": "^2.6.0-cloc",
|
|
"eslint": "9.39.4",
|
|
"eslint-plugin-import-x": "4.16.2",
|
|
"eslint-plugin-security": "^4.0.1",
|
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
"eslint-plugin-solid": "^0.14.5",
|
|
"eslint-plugin-sonarjs": "^4.1.0",
|
|
"fake-indexeddb": "^6.2.5",
|
|
"jsdom": "^28.1.0",
|
|
"playwright": "^1.59.1",
|
|
"prettier": "3.8.3",
|
|
"prettier-plugin-one-line-imports": "1.0.3",
|
|
"solid-devtools": "^0.34.5",
|
|
"typescript": "^5.7.2",
|
|
"typescript-eslint": "8.58.2",
|
|
"typescript-plugin-css-modules": "^5.2.0",
|
|
"vite": "^8.0.9",
|
|
"vite-bundle-analyzer": "^1.3.6",
|
|
"vite-plugin-pwa": "^1.2.0",
|
|
"vite-plugin-solid": "^2.11.12",
|
|
"vitest": "^4.0.18"
|
|
}
|
|
}
|