Skip to content

Commit

Permalink
Primary caching 2: Introduce FlatVecDeque (#4593)
Browse files Browse the repository at this point in the history
Introduce `FlatVecDeque` (feel free to rename), the core datastructure
behind the primary cache.

You can view it as a "native", circular `ListArray`: it's a flattened
array of arrays, implemented as two ringbuffers, that stores actual
components (i.e. deserialized data) in a cache friendly way.
Also plenty of APIs to get data in and out, in and out of order.

Once again, these benchmarks are disabled on CI.

Some numbers for posterity / git log (5950X, Arch):
```
flat_vec_deque/insert/empty                     1.00    310.9±3.87ns  3.0 GElem/sec
flat_vec_deque/insert/prefilled/back            1.00     28.6±0.20µs 33.4 MElem/sec
flat_vec_deque/insert/prefilled/front           1.00     29.1±0.17µs 32.7 MElem/sec
flat_vec_deque/insert/prefilled/middle          1.00     42.8±0.57µs 22.3 MElem/sec
flat_vec_deque/insert_range/empty               1.00      3.5±0.04µs 1348.1 MElem/sec
flat_vec_deque/insert_range/prefilled/back      1.00     31.9±0.20µs 149.4 MElem/sec
flat_vec_deque/insert_range/prefilled/front     1.00     30.6±0.17µs 155.7 MElem/sec
flat_vec_deque/insert_range/prefilled/middle    1.00     46.3±0.20µs 102.9 MElem/sec
flat_vec_deque/insert_with/empty                1.00  1375.4±43.80ns  3.4 GElem/sec
flat_vec_deque/insert_with/prefilled/back       1.00     30.1±0.16µs 158.6 MElem/sec
flat_vec_deque/insert_with/prefilled/front      1.00     27.8±0.83µs 171.5 MElem/sec
flat_vec_deque/insert_with/prefilled/middle     1.00     44.8±0.34µs 106.4 MElem/sec
flat_vec_deque/range/prefilled/back             1.00     15.3±0.05µs 312.3 MElem/sec
flat_vec_deque/range/prefilled/front            1.00     15.8±0.15µs 301.2 MElem/sec
flat_vec_deque/range/prefilled/middle           1.00     14.8±0.09µs 323.2 MElem/sec
flat_vec_deque/remove/prefilled/back            1.00     14.4±0.07µs 67.8 KElem/sec
flat_vec_deque/remove/prefilled/front           1.00     28.5±0.28µs 34.2 KElem/sec
flat_vec_deque/remove/prefilled/middle          1.00     28.5±0.11µs 34.3 KElem/sec
flat_vec_deque/remove_range/prefilled/back      1.00     14.6±0.07µs 326.0 MElem/sec
flat_vec_deque/remove_range/prefilled/front     1.00     28.6±0.16µs 166.7 MElem/sec
flat_vec_deque/remove_range/prefilled/middle    1.00     29.3±0.17µs 162.8 MElem/sec
```

---

Part of the primary caching series of PR (index search, joins,
deserialization):
- #4592
- #4593
  • Loading branch information
teh-cmc authored Jan 2, 2024
1 parent 7590f38 commit e309749
Show file tree
Hide file tree
Showing 6 changed files with 1,274 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ re_log_encoding = { path = "crates/re_log_encoding", version = "=0.12.0-alpha.3"
re_log_types = { path = "crates/re_log_types", version = "=0.12.0-alpha.3", default-features = false }
re_memory = { path = "crates/re_memory", version = "=0.12.0-alpha.3", default-features = false }
re_query = { path = "crates/re_query", version = "=0.12.0-alpha.3", default-features = false }
re_query_cache = { path = "crates/re_query_cache", version = "=0.12.0-alpha.3", default-features = false }
re_renderer = { path = "crates/re_renderer", version = "=0.12.0-alpha.3", default-features = false }
re_sdk = { path = "crates/re_sdk", version = "=0.12.0-alpha.3", default-features = false }
re_sdk_comms = { path = "crates/re_sdk_comms", version = "=0.12.0-alpha.3", default-features = false }
Expand Down
49 changes: 49 additions & 0 deletions crates/re_query_cache/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[package]
name = "re_query_cache"
authors.workspace = true
description = "Caching datastructures for re_query"
edition.workspace = true
homepage.workspace = true
include.workspace = true
license.workspace = true
publish = true
readme = "README.md"
repository.workspace = true
rust-version.workspace = true
version.workspace = true

[package.metadata.docs.rs]
all-features = true


[features]
default = []

[dependencies]
# Rerun dependencies:
re_log_types.workspace = true
re_query.workspace = true
re_types_core.workspace = true

# External dependencies:
ahash.workspace = true
document-features.workspace = true
itertools.workspace = true
thiserror.workspace = true


[dev-dependencies]
re_log_types = { workspace = true, features = ["testing"] }

criterion.workspace = true
mimalloc.workspace = true
similar-asserts.workspace = true


[lib]
bench = false


[[bench]]
name = "flat_vec_deque"
harness = false
Loading

0 comments on commit e309749

Please sign in to comment.