Skip to content

Commit

Permalink
avoid copying validator data in accessor
Browse files Browse the repository at this point in the history
```
    5291.227,        0.000,     5291.227,     5291.227,            1, Initialize DB
       0.436,        0.928,        0.138,       51.438,         3155, Load block from database
   11962.826,        0.000,    11962.826,    11962.826,            1, Load state from database
       6.477,        1.675,        0.037,       34.174,         3101, Advance slot, non-epoch
      76.633,        3.705,       71.106,       98.085,          100, Advance slot, epoch
      18.301,       18.593,       13.208,      149.153,         3155, Apply block, no slot processing
       0.000,        0.000,        0.000,        0.000,            0, Database load
       0.000,        0.000,        0.000,        0.000,            0, Database store
```
  • Loading branch information
arnetheduck committed Nov 11, 2021
1 parent 1e2568f commit 2ce1858
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions beacon_chain/spec/datatypes/base.nim
Original file line number Diff line number Diff line change
Expand Up @@ -623,13 +623,13 @@ proc readValue*(reader: var JsonReader, value: var ForkDigest)
static: doAssert high(int) >= high(int32)

# `ValidatorIndex` seq handling.
func `[]`*[T](a: var seq[T], b: ValidatorIndex): var T =
template `[]`*[T](a: var seq[T], b: ValidatorIndex): var T =
a[b.int]

func `[]=`*[T](a: var seq[T], b: ValidatorIndex, c: T) =
template `[]=`*[T](a: var seq[T], b: ValidatorIndex, c: T) =
a[b.int] = c

func `[]`*[T](a: seq[T], b: ValidatorIndex): auto =
template `[]`*[T](a: seq[T], b: ValidatorIndex): auto =
a[b.int]

# `ValidatorIndex` Nim integration
Expand Down

0 comments on commit 2ce1858

Please sign in to comment.