-
-
Notifications
You must be signed in to change notification settings - Fork 40
Fnv hasher with default capacity #44
base: master
Are you sure you want to change the base?
Conversation
src/lib.rs
Outdated
use std::fmt; | ||
use std::marker::PhantomData; | ||
|
||
use pyo3::prelude::*; | ||
use serde::de::{self, DeserializeSeed, Deserializer, MapAccess, SeqAccess, Visitor}; | ||
use serde::ser::{self, Serialize, SerializeMap, SerializeSeq, Serializer}; | ||
|
||
const DEFAUL_HASHMAP_CAPACITY: usize = 10; |
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.
should be DEFAULT_HASHMAP_CAPACITY
I guess. 😉
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.
Oh right. Shame on me)
Thanks for your PRs @greyblake. For sure sounds like a nice idea to try. |
So I ran the benchmarks on my machine and the values of this branch are very close to the master branch, well within the standard deviation. That means I can't make any conclusive judgement as to what is the faster version. Maybe others can try to reproduce on their machine? |
Here are my benchmarks for Python 3.5, done on my laptop (debian). master.txt Here the result aggregated in one spreadsheet: https://docs.google.com/spreadsheets/d/1vrERpk-QLZYLQOHu8nh6fIAeTdEbNxp5bJEIPc-N-MM/edit?usp=sharing However, if I run the benchmark multiple times I get different results, so yea, based on this it's hard to judge if this is a real improvement. |
Pretty similar to what I saw in my benchmarks.
The docs are here. |
Ok, running the following command:
Shows to me a more or less reproducible result (I've tried 2 times).
|
I'm in the process of setting up a machine for profiling. Have a dedicated Linux box now for that purpose. If anybody has time to profile the code before me, feel free to do that and add some data here. |
This PR goes on top of #43
Changes:
entites
with default capacity > 0.This may safe some extra memory allocations.
Benchmarks are again slightly contradictional.
Please consider this PR only like an idea. Feel free to reject it if it does not bring any useful improvement