Commit c4b9399
fix(db): compile filter expression once instead of on every invocation (#954)
* fix(db): compile filter expression once instead of on every invocation
Previously, `createFilterFunctionFromExpression` was calling
`compileSingleRowExpression(expression)` inside the returned filter
function, causing the expression to be recompiled for every item
being filtered. This resulted in severe performance degradation when
filtering large collections, as `normalizeValue` and other compilation
functions were called thousands of times unnecessarily.
Move the compilation outside the returned function so it happens once
when the filter function is created.
* chore: add changeset for filter expression compile fix
---------
Co-authored-by: Claude <[email protected]>1 parent e12514a commit c4b9399
File tree
2 files changed
+10
-1
lines changed- .changeset
- packages/db/src/collection
2 files changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
224 | 227 | | |
225 | 228 | | |
226 | | - | |
227 | 229 | | |
228 | 230 | | |
229 | 231 | | |
| |||
0 commit comments