lance-format / lance-format/lance

refactor: use LazyLock to initialize Field and Schema once

Open
#8,244 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
Rust
Stars
7.1k
Forks
852
Avg merge
3d 18h
Merged PRs (30d)
272

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with rust/lance-index/src/scalar/inverted/index.rs at the linked schema construction around lines 8107-8116, then search the repository for similar repeated Field or Schema creation. Convert the applicable repeated outputs to one-time LazyLock initialization wrapped in Arc, and consider the work done when the relevant repeated constructions no longer occur per method call or batch.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.