Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,7 @@
## 2024-05-31 - [Architecture Scaffold Migration]
**Learning:** Initial structural scaffolding of modular enterprise agents should start with explicit Protocol/ABC interfaces, ensuring strong separation between System 1 (probabilistic swarms) and deterministic math. Additive extraction from existing files ensures functional equivalence.
**Action:** Always document the purpose, inputs, and outputs via standardized docstrings to support future multi-agent memory parsing.

## 2024-05-23 - Memoization of sorting logic in HFTView
**Learning:** Found unnecessary `O(N log N)` re-evaluations inside React component body due to sorting logic. Sorting should be memoized with `useMemo` when working with potentially large lists inside render loops, especially in high-frequency trading view components that might get frequent re-renders from parent state changes.
**Action:** Always wrap heavy list transformations (like sort, filter over large datasets) inside `useMemo` in React components to avoid burning CPU cycles on unchanged data.
6 changes: 5 additions & 1 deletion webapp/src/components/simulation-tools/GammaSimulator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,12 @@ function InstitutionalView({ nodes }: { nodes: any[] }) {
}

function HFTView({ nodes }: { nodes: any[] }) {
// ⚑ Bolt: Wrapped sortedNodes in useMemo to prevent O(N log N) sorting on every re-render of HFTView.
// Expected Impact: Reduces CPU cycle waste when the HFTView re-renders due to other state changes without nodes changing.
// Sort by liquidity (most distressed first) to simulate an order book looking for targets
const sortedNodes = [...nodes].sort((a, b) => a.currentIcr - b.currentIcr).slice(0, 50); // Show top 50
const sortedNodes = useMemo(() =>
[...nodes].sort((a, b) => a.currentIcr - b.currentIcr).slice(0, 50),
[nodes]); // Show top 50

return (
<div className="flex-1 p-4 flex flex-col h-full overflow-hidden bg-black rounded-lg">
Expand Down
Loading