Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rearchitect router internals. #144

Merged
merged 1 commit into from
Sep 7, 2024

Conversation

CathalMullan
Copy link
Contributor

@CathalMullan CathalMullan commented Sep 7, 2024

Some work to be done on the performance side of things.

Assuming that due to moving the data out of the node, our cache locality is worse. Plus now we need a hashmap lookup per match.

Instead of a hashmap, we could use a vec + index approach.
But would make updates/deletes painful.

We could just change NodeData into an enum?

/// Holds data associated with a given node.
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum NodeData<T> {
    /// Data is stored inline.
    Inline(T),

    /// Data is stored at the router level, as it's shared between 2 or more nodes.
    Reference(Arc<str>),
}

EDIT: Yes, much better. Happy to take a 5% hit for this, down from 20%.

We still need to actually disconnect the end-node -> data relationship. Right now, we've just moved it elsewhere.

EDIT: Also, should ensure we use constant terms. I've mixed up path and route multiple times in the docs.

This is only really a 'part 1'.
We'll flesh out the finer details as part of the optional params support.

@CathalMullan CathalMullan linked an issue Sep 7, 2024 that may be closed by this pull request
Copy link

codecov bot commented Sep 7, 2024

Codecov Report

Attention: Patch coverage is 73.91304% with 6 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/router.rs 73.91% 5 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
src/node/search.rs 78.11% <ø> (ø)
src/router.rs 88.88% <73.91%> (-1.95%) ⬇️

Copy link

codspeed-hq bot commented Sep 7, 2024

CodSpeed Performance Report

Merging #144 will degrade performances by 5.39%

Comparing 143-reconsider-router-internal-structure (02687bf) with main (15dd3fe)

Summary

❌ 1 regressions
✅ 15 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main 143-reconsider-router-internal-structure Change
path-tree benchmarks/wayfind 66.5 µs 70.2 µs -5.39%

@CathalMullan CathalMullan force-pushed the 143-reconsider-router-internal-structure branch 5 times, most recently from e10456a to 59b13ed Compare September 7, 2024 20:16
@CathalMullan CathalMullan force-pushed the 143-reconsider-router-internal-structure branch from 59b13ed to 02687bf Compare September 7, 2024 20:26
@CathalMullan CathalMullan marked this pull request as ready for review September 7, 2024 20:31
@CathalMullan CathalMullan merged commit 77ad7a1 into main Sep 7, 2024
6 of 7 checks passed
@CathalMullan CathalMullan deleted the 143-reconsider-router-internal-structure branch September 7, 2024 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reconsider router internal structure
1 participant