perf(csv-loader): optimize reverse reference resolution

Implement a reverse lookup cache to avoid re-filtering the entire
referenced table for every row during reverse reference resolution.
This improves performance from O(N*M) to O(N+M) where N is the number
of rows in the current table and M is the number of rows in the
referenced table.

Also update documentation to reflect the new union resolution
behavior and migration notes for version 2.0.0.
This commit is contained in:
2026-08-06 10:27:18 +08:00
parent 37e3514c0c
commit 641af7341a
5 changed files with 115 additions and 12 deletions
+10
View File
@@ -149,6 +149,16 @@ Uses [typed-csv](https://github.com/your-repo/typed-csv) syntax:
| Array | `string[]` | `[a; b; c]` |
| Tuple | `[string; number]` | `[hello; 42]` |
> **Note:** `int` and `float` are accepted in schemas and validated at parse time, but both collapse to `number` in generated type declarations.
## Migration from 1.x
- Composite values must be fully bracketed: `[[a; 1]; [b; 2]]`, not `[a; 1]; [b; 2]`.
- The `[Type][]` array form is removed — use `Type[]`.
- `[single]` is a 1-tuple, not an array.
- In unions containing references, reference members are tried first.
- Double-quoted string literals (`"active" | "inactive"`) in a schema row are handled automatically.
## License
ISC