Set map initial cacacity in epoch cache builder
This should help reduce reallocations
This commit is contained in:
parent
96d96ba9ba
commit
8154397114
@ -33,12 +33,13 @@ impl EpochCache {
|
|||||||
) -> Result<EpochCache, Error> {
|
) -> Result<EpochCache, Error> {
|
||||||
let mut epoch_committees: Vec<CrosslinkCommittees> =
|
let mut epoch_committees: Vec<CrosslinkCommittees> =
|
||||||
Vec::with_capacity(spec.slots_per_epoch as usize);
|
Vec::with_capacity(spec.slots_per_epoch as usize);
|
||||||
let mut attestation_duty_map: AttestationDutyMap = HashMap::new();
|
|
||||||
let mut shard_committee_index_map: ShardCommitteeIndexMap = HashMap::new();
|
let mut shard_committee_index_map: ShardCommitteeIndexMap = HashMap::new();
|
||||||
|
|
||||||
let shuffling =
|
let shuffling =
|
||||||
state.get_shuffling_for_slot(epoch.start_slot(spec.slots_per_epoch), false, spec)?;
|
state.get_shuffling_for_slot(epoch.start_slot(spec.slots_per_epoch), false, spec)?;
|
||||||
|
|
||||||
|
let mut attestation_duty_map: AttestationDutyMap = HashMap::with_capacity(shuffling.len());
|
||||||
|
|
||||||
for (epoch_committeess_index, slot) in epoch.slot_iter(spec.slots_per_epoch).enumerate() {
|
for (epoch_committeess_index, slot) in epoch.slot_iter(spec.slots_per_epoch).enumerate() {
|
||||||
let slot_committees = state.calculate_crosslink_committees_at_slot(
|
let slot_committees = state.calculate_crosslink_committees_at_slot(
|
||||||
slot,
|
slot,
|
||||||
|
Loading…
Reference in New Issue
Block a user