Skip to content

Commit

Permalink
xmr: bp - KeyVEval - caching current element, avoid allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Aug 17, 2018
1 parent 83ba7a6 commit b264a65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/apps/monero/xmr/bulletproof.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,12 @@ class KeyVEval(KeyV):
def __init__(self, elems=64, src=None):
self.size = elems
self.fnc = src
self.buff = _ensure_dst_key()
self.mv = memoryview(self.buff)

def __getitem__(self, item):
return memoryview(self.fnc(item))
self.fnc(item, self.mv)
return self.mv

def __setitem__(self, key, value):
raise ValueError("Constant vector")
Expand Down

0 comments on commit b264a65

Please sign in to comment.