-
Notifications
You must be signed in to change notification settings - Fork 61
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
Benchmarks for find_entry #180
Conversation
src/index.rs
Outdated
key_prefix: u64, | ||
sub_index: usize, | ||
chunk: &[u8; CHUNK_LEN], | ||
) -> (Entry, usize) { | ||
assert!(chunk.len() >= CHUNK_ENTRIES * 8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the assert still needed ?
src/index.rs
Outdated
let i = index % 64; | ||
let x = f(&table, keys[i], 0, &chunk).1; | ||
assert_eq!(x, i); | ||
index += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would make sense to me to have the 64 query under iter (so nb iter don't interfer (actually with this use case it probably does not really matter)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under real workload chunks are never full. I'd guess average occupancy is about 33%. With just a few entries base variant will probably be faster, while with 64 entries simd will probably be faster. This cycle averages it.
src/index.rs
Outdated
IndexTable { id: TableId(18), map: RwLock::new(None), path: Default::default() }; | ||
let mut chunk = [0u8; 512]; | ||
let mut keys = [0u64; 64]; | ||
let mut rng = rand::thread_rng(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not too sure if we should bench on random content (could be just random from a fix seed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, even though It does not matter too much what the entry bits are, as long as they are different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to @cheme suggestions
Also added a small optimization for
chunk_at