Skip to content
Snippets Groups Projects
Commit 2e01c382 authored by Éloïs's avatar Éloïs
Browse files

[opti] blockchain-dal: use FnvHashMap for maps with integer key

parent 0f31a10c
No related branches found
No related tags found
No related merge requests found
...@@ -409,6 +409,7 @@ dependencies = [ ...@@ -409,6 +409,7 @@ dependencies = [
"dup-crypto-tests-tools 0.1.0", "dup-crypto-tests-tools 0.1.0",
"durs-common-tools 0.1.0", "durs-common-tools 0.1.0",
"durs-wot 0.8.0-a0.9", "durs-wot 0.8.0-a0.9",
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"id_tree 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "id_tree 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-tests-tools 0.1.0", "rust-tests-tools 0.1.0",
...@@ -594,6 +595,11 @@ name = "fake-simd" ...@@ -594,6 +595,11 @@ name = "fake-simd"
version = "0.1.2" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "fnv"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "foreign-types" name = "foreign-types"
version = "0.3.2" version = "0.3.2"
...@@ -1479,6 +1485,7 @@ dependencies = [ ...@@ -1479,6 +1485,7 @@ dependencies = [
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
"checksum fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81f7f8eb465745ea9b02e2704612a9946a59fa40572086c6fd49d6ddcf30bf31" "checksum fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81f7f8eb465745ea9b02e2704612a9946a59fa40572086c6fd49d6ddcf30bf31"
......
...@@ -15,6 +15,7 @@ dubp-documents= { path = "../../../tools/documents" } ...@@ -15,6 +15,7 @@ dubp-documents= { path = "../../../tools/documents" }
duniter-module = { path = "../../../core/module" } duniter-module = { path = "../../../core/module" }
durs-common-tools = { path = "../../../tools/common-tools" } durs-common-tools = { path = "../../../tools/common-tools" }
durs-wot = { path = "../../../tools/wot" } durs-wot = { path = "../../../tools/wot" }
fnv = "1.0.6"
id_tree = "1.3.0" id_tree = "1.3.0"
log = "0.4.*" log = "0.4.*"
rustbreak = {version = "2.0.0-rc3", features = ["bin_enc"]} rustbreak = {version = "2.0.0-rc3", features = ["bin_enc"]}
......
...@@ -58,6 +58,7 @@ use dubp_documents::{BlockHash, BlockId, Blockstamp, PreviousBlockstamp}; ...@@ -58,6 +58,7 @@ use dubp_documents::{BlockHash, BlockId, Blockstamp, PreviousBlockstamp};
use dup_crypto::hashs::Hash; use dup_crypto::hashs::Hash;
use dup_crypto::keys::*; use dup_crypto::keys::*;
use durs_wot::data::{rusty::RustyWebOfTrust, NodeId}; use durs_wot::data::{rusty::RustyWebOfTrust, NodeId};
use fnv::FnvHashMap;
use rustbreak::backend::{FileBackend, MemoryBackend}; use rustbreak::backend::{FileBackend, MemoryBackend};
use rustbreak::error::{RustbreakError, RustbreakErrorKind}; use rustbreak::error::{RustbreakError, RustbreakErrorKind};
use rustbreak::{deser::Bincode, Database, FileDatabase, MemoryDatabase}; use rustbreak::{deser::Bincode, Database, FileDatabase, MemoryDatabase};
...@@ -78,7 +79,7 @@ use crate::writers::transaction::DALTxV10; ...@@ -78,7 +79,7 @@ use crate::writers::transaction::DALTxV10;
/// Currency parameters (Protocol V10) /// Currency parameters (Protocol V10)
pub type CurrencyParamsV10Datas = (CurrencyName, BlockV10Parameters); pub type CurrencyParamsV10Datas = (CurrencyName, BlockV10Parameters);
/// All blocks of local blockchain indexed by block number /// All blocks of local blockchain indexed by block number
pub type LocalBlockchainV10Datas = HashMap<BlockId, DALBlock>; pub type LocalBlockchainV10Datas = FnvHashMap<BlockId, DALBlock>;
/// Forks tree meta datas (block number and hash only) /// Forks tree meta datas (block number and hash only)
pub type ForksTreeV10Datas = entities::fork_tree::ForkTree; pub type ForksTreeV10Datas = entities::fork_tree::ForkTree;
/// Forks blocks referenced in tree indexed by their blockstamp /// Forks blocks referenced in tree indexed by their blockstamp
...@@ -90,9 +91,9 @@ pub type WotDB = RustyWebOfTrust; ...@@ -90,9 +91,9 @@ pub type WotDB = RustyWebOfTrust;
/// V10 Identities indexed by public key /// V10 Identities indexed by public key
pub type IdentitiesV10Datas = HashMap<PubKey, DALIdentity>; pub type IdentitiesV10Datas = HashMap<PubKey, DALIdentity>;
/// Memberships sorted by created block /// Memberships sorted by created block
pub type MsExpirV10Datas = HashMap<BlockId, HashSet<NodeId>>; pub type MsExpirV10Datas = FnvHashMap<BlockId, HashSet<NodeId>>;
/// Certifications sorted by created block /// Certifications sorted by created block
pub type CertsExpirV10Datas = HashMap<BlockId, HashSet<(NodeId, NodeId)>>; pub type CertsExpirV10Datas = FnvHashMap<BlockId, HashSet<(NodeId, NodeId)>>;
/// V10 Transactions indexed by their hashs /// V10 Transactions indexed by their hashs
pub type TxV10Datas = HashMap<Hash, DALTxV10>; pub type TxV10Datas = HashMap<Hash, DALTxV10>;
/// V10 Unused Transaction Output (=sources) /// V10 Unused Transaction Output (=sources)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment