lance-format/lance

refactor: use LazyLock to initialize Field and Schema once

Aperta

#8244 aperta il 4 ago 2026

 (2 commenti) (0 reazioni) (0 assegnatari)Rust (695 fork)github user discovery
good first issue

Metriche repository

Star
 (6582 stelle)
Metriche merge PR
 (Merge medio 6g 1h) (219 PR mergiate in 30 g)

Descrizione

In many places we output the same set of fields and/or schema per method call, or even per batch. This can be made cheaper if we initialize them once via a LazyLock and wrapping in an Arc.

Here's an example where we construct a schema per query:

https://github.com/lance-format/lance/blob/11eeb29161a2ac2763ff8cc6aa1fde8eb4592291/rust/lance-index/src/scalar/inverted/index.rs#L8107-L8116

Guida contributor