Skip to content

Commit

Permalink
perf: Use bumpalo to control memory allocation of Sort and `Table…
Browse files Browse the repository at this point in the history
…Codec`
  • Loading branch information
KKould committed Dec 11, 2024
1 parent d09b8fc commit 80ae6e6
Show file tree
Hide file tree
Showing 13 changed files with 702 additions and 476 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ harness = false
[dependencies]
ahash = { version = "0.8" }
bincode = { version = "1" }
bumpalo = { version = "3", features = ["allocator-api2", "collections", "std"] }
byteorder = { version = "1" }
chrono = { version = "0.4" }
comfy-table = { version = "7" }
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ run `cargo run -p tpcc --release` to run tpcc
- Tips: TPC-C currently only supports single thread
```shell
<90th Percentile RT (MaxRT)>
New-Order : 0.003 (0.031)
Payment : 0.001 (0.028)
Order-Status : 0.053 (0.144)
Delivery : 0.020 (0.032)
Stock-Level : 0.004 (0.007)
New-Order : 0.003 (0.053)
Payment : 0.001 (0.011)
Order-Status : 0.052 (0.110)
Delivery : 0.021 (0.046)
Stock-Level : 0.003 (0.005)
<TpmC>
7457 Tpmc
7567 Tpmc
```
#### 👉[check more](tpcc/README.md)

Expand Down
2 changes: 1 addition & 1 deletion src/execution/dml/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl<'a, T: Transaction + 'a> WriteExecutor<'a, T> for Analyze {
builders.push((
index.id,
throw!(index.column_exprs(&table)),
throw!(HistogramBuilder::new(index, None)),
HistogramBuilder::new(index, None),
));
}

Expand Down
5 changes: 4 additions & 1 deletion src/execution/dql/join/hash_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,12 @@ mod test {
use crate::planner::operator::Operator;
use crate::planner::{Childrens, LogicalPlan};
use crate::storage::rocksdb::RocksStorage;
use crate::storage::table_codec::BumpBytes;
use crate::storage::Storage;
use crate::types::value::DataValue;
use crate::types::LogicalType;
use crate::utils::lru::SharedLruCache;
use bumpalo::Bump;
use std::hash::RandomState;
use std::sync::Arc;
use tempfile::TempDir;
Expand Down Expand Up @@ -494,9 +496,10 @@ mod test {
executor.execute((&table_cache, &view_cache, &meta_cache), &mut transaction),
)?;

let arena = Bump::new();
assert_eq!(tuples.len(), 2);
tuples.sort_by_key(|tuple| {
let mut bytes = Vec::new();
let mut bytes = BumpBytes::new_in(&arena);
tuple.values[0].memcomparable_encode(&mut bytes).unwrap();
bytes
});
Expand Down
Loading

0 comments on commit 80ae6e6

Please sign in to comment.