Commit b6171d5
committed
perf(watchd): read the sequence number once per room, not per event
record_event called next_seq() for every incoming event, and next_seq reads
the entire log plus its rotated generation. On a log of tens of thousands of
records that is megabytes of parsing per message, and it grows with the log -
a busy room would get slower the longer the daemon ran.
The number is now read once per room and carried in memory. Safe because the
daemon is the only writer: it holds the store lock for its whole run and
nothing else appends to these logs.
Found reviewing the implementation before merge, not by a test - the cost is
invisible to a correctness test and only shows on a log with history.
Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>1 parent 499dbba commit b6171d5
1 file changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
175 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
176 | 192 | | |
177 | | - | |
| 193 | + | |
178 | 194 | | |
179 | 195 | | |
180 | 196 | | |
181 | 197 | | |
182 | 198 | | |
| 199 | + | |
183 | 200 | | |
184 | 201 | | |
185 | 202 | | |
| |||
0 commit comments