Skip to content

layout reader ctx#8037

Merged
onursatici merged 4 commits into
developfrom
os/layout-overrides
Jun 2, 2026
Merged

layout reader ctx#8037
onursatici merged 4 commits into
developfrom
os/layout-overrides

Conversation

@onursatici

@onursatici onursatici commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Introduce LayoutReaderContext, a typed-data registry threaded through reader construction so an ancestor layout can publish values that descendant layouts look up by type at construction time.

Breaking: Layout::new_reader and VTable::new_reader gain a &LayoutReaderContext parameter. Out-of-tree impls will get a compile error and must add it

@onursatici onursatici requested a review from joseph-isaacs May 20, 2026 14:25
@codspeed-hq

codspeed-hq Bot commented May 20, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 13.42%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚡ 2 improved benchmarks
✅ 1273 untouched benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation take_map[(0.1, 1.0)] 1.9 ms 1.7 ms +16.15%
Simulation take_map[(0.1, 0.5)] 1,092.6 µs 986.5 µs +10.75%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing os/layout-overrides (34bf8aa) with develop (5aa3f3d)

Open in CodSpeed

@onursatici onursatici added the changelog/break A breaking API change label May 20, 2026
Comment thread vortex-layout/src/reader.rs Outdated
/// children helpers and survive any single stack frame.
#[derive(Clone, Default)]
pub struct LayoutReaderContext {
values: Arc<HashMap<TypeId, Arc<dyn Any + Send + Sync>>>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No TypeId please

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would that import bug that hit our use of type id be relevant for this type of use as well? I can use the layout id here, I think it is a bit of a weirder api to have but should work

@joseph-isaacs joseph-isaacs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a Array like Id instead of a TypeId

@gatesn

gatesn commented May 26, 2026

Copy link
Copy Markdown
Contributor

What's wrong with TypeId? We use this structure for all ephemeral context objects, i.e. VortexSession.

It works correctly, is very fast, and helps keep it clear that this stuff is never serialized.

The general Id is more used for things that are serialized and then later looked up in a registry on the other end.

Comment thread vortex-layout/src/layouts/chunked/mod.rs Outdated
Comment thread vortex-layout/src/reader.rs Outdated
Comment thread vortex-layout/src/layout.rs
@joseph-isaacs

Copy link
Copy Markdown
Contributor

A type id is not a stable id outside on a single compiler patch version.

Signed-off-by: Onur Satici <onur@spiraldb.com>
Signed-off-by: Onur Satici <onur@spiraldb.com>
Signed-off-by: Onur Satici <onur@spiraldb.com>
Signed-off-by: Onur Satici <onur@spiraldb.com>
@onursatici onursatici force-pushed the os/layout-overrides branch from 906945c to 34bf8aa Compare June 2, 2026 13:09
@onursatici onursatici enabled auto-merge (squash) June 2, 2026 13:13
@onursatici onursatici merged commit b29b2b9 into develop Jun 2, 2026
61 checks passed
@onursatici onursatici deleted the os/layout-overrides branch June 2, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/break A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants