Skip to content

Commit 80ae6e6

Browse files
committed
perf: Use bumpalo to control memory allocation of Sort and TableCodec
1 parent d09b8fc commit 80ae6e6

File tree

13 files changed

+702
-476
lines changed

13 files changed

+702
-476
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ harness = false
3535
[dependencies]
3636
ahash = { version = "0.8" }
3737
bincode = { version = "1" }
38+
bumpalo = { version = "3", features = ["allocator-api2", "collections", "std"] }
3839
byteorder = { version = "1" }
3940
chrono = { version = "0.4" }
4041
comfy-table = { version = "7" }

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ run `cargo run -p tpcc --release` to run tpcc
7373
- Tips: TPC-C currently only supports single thread
7474
```shell
7575
<90th Percentile RT (MaxRT)>
76-
New-Order : 0.003 (0.031)
77-
Payment : 0.001 (0.028)
78-
Order-Status : 0.053 (0.144)
79-
Delivery : 0.020 (0.032)
80-
Stock-Level : 0.004 (0.007)
76+
New-Order : 0.003 (0.053)
77+
Payment : 0.001 (0.011)
78+
Order-Status : 0.052 (0.110)
79+
Delivery : 0.021 (0.046)
80+
Stock-Level : 0.003 (0.005)
8181
<TpmC>
82-
7457 Tpmc
82+
7567 Tpmc
8383
```
8484
#### 👉[check more](tpcc/README.md)
8585

src/execution/dml/analyze.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<'a, T: Transaction + 'a> WriteExecutor<'a, T> for Analyze {
7777
builders.push((
7878
index.id,
7979
throw!(index.column_exprs(&table)),
80-
throw!(HistogramBuilder::new(index, None)),
80+
HistogramBuilder::new(index, None),
8181
));
8282
}
8383

src/execution/dql/join/hash_join.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,12 @@ mod test {
312312
use crate::planner::operator::Operator;
313313
use crate::planner::{Childrens, LogicalPlan};
314314
use crate::storage::rocksdb::RocksStorage;
315+
use crate::storage::table_codec::BumpBytes;
315316
use crate::storage::Storage;
316317
use crate::types::value::DataValue;
317318
use crate::types::LogicalType;
318319
use crate::utils::lru::SharedLruCache;
320+
use bumpalo::Bump;
319321
use std::hash::RandomState;
320322
use std::sync::Arc;
321323
use tempfile::TempDir;
@@ -494,9 +496,10 @@ mod test {
494496
executor.execute((&table_cache, &view_cache, &meta_cache), &mut transaction),
495497
)?;
496498

499+
let arena = Bump::new();
497500
assert_eq!(tuples.len(), 2);
498501
tuples.sort_by_key(|tuple| {
499-
let mut bytes = Vec::new();
502+
let mut bytes = BumpBytes::new_in(&arena);
500503
tuple.values[0].memcomparable_encode(&mut bytes).unwrap();
501504
bytes
502505
});

0 commit comments

Comments
 (0)