mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-26 09:50:40 +00:00
perf: avoid boundary checks on accessing array items (#7570)
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -1174,9 +1174,8 @@ pub(crate) fn decode_primary_keys_with_counts(
|
||||
let mut result: Vec<(CompositeValues, usize)> = Vec::new();
|
||||
let mut prev_key: Option<u32> = None;
|
||||
|
||||
for i in 0..keys.len() {
|
||||
let current_key = keys.value(i);
|
||||
|
||||
let pk_indices = keys.values();
|
||||
for ¤t_key in pk_indices.iter().take(keys.len()) {
|
||||
// Checks if current key is the same as previous key
|
||||
if let Some(prev) = prev_key
|
||||
&& prev == current_key
|
||||
|
||||
@@ -563,9 +563,8 @@ pub(crate) fn decode_primary_keys(
|
||||
|
||||
// The parquet reader may read the whole dictionary page into the dictionary values, so
|
||||
// we may decode many primary keys not in this batch if we decode the values array directly.
|
||||
for i in 0..keys.len() {
|
||||
let current_key = keys.value(i);
|
||||
|
||||
let pk_indices = keys.values();
|
||||
for ¤t_key in pk_indices.iter().take(keys.len()) {
|
||||
// Check if current key is the same as previous key
|
||||
if let Some(prev) = prev_key
|
||||
&& prev == current_key
|
||||
|
||||
Reference in New Issue
Block a user