From 46e18a62e4c4f1de74efd553137b90fba90c6b7e Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 20 Feb 2026 08:30:36 -0600 Subject: [PATCH] Add TODO.md with remaining performance improvements --- TODO.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 TODO.md diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..d84677c --- /dev/null +++ b/TODO.md @@ -0,0 +1,27 @@ +# Performance TODO + +## N+1 query in load_rf_path_station_packets + +`index.ex:895` — `handle_info({:load_rf_path_station_packets, stations})` still does N+1 +`Packets.get_latest_packet_for_callsign/1` calls per station. Unlike the RF path position +lookup (which only needs lat/lng), this needs full packet data for building markers with +popups. A batch version of `get_latest_packet_for_callsign` returning full packets via +`DISTINCT ON` would eliminate this. + +## Batch remove_marker events + +`PacketProcessor.batch_dispatch({false, true}, ...)` still pushes individual `remove_marker` +events during batch processing. These are rare (packet goes out of bounds) but could be +batched into a single `remove_markers` event with a list of IDs if profiling shows it matters. + +## PostgreSQL table partitioning + +The packets table uses CTE-based batch DELETE for cleanup (7-day retention). Time-range +partitioning would make cleanup instant (DROP partition) and improve query performance for +time-bounded queries. This is a significant migration effort. + +## ETS table for :aprsme — write path + +Changed `:aprsme` from `write_concurrency` to `read_concurrency`. The only write is +`:message_number` increment. If message throughput increases significantly, consider using +`:atomics` or `:counters` instead of ETS for the message counter.