cache rope when threads are enabled (#19981)
* cache rope * add threadvar
This commit is contained in:
parent
430a179307
commit
dcb28fd061
1 changed files with 5 additions and 6 deletions
|
|
@ -86,13 +86,12 @@ proc newRope(data: string = ""): Rope =
|
|||
result.L = -data.len
|
||||
result.data = data
|
||||
|
||||
when not compileOption("threads"):
|
||||
var
|
||||
cache: array[0..2048*2 - 1, Rope]
|
||||
var
|
||||
cache {.threadvar.} : array[0..2048*2 - 1, Rope]
|
||||
|
||||
proc resetRopeCache* =
|
||||
for i in low(cache)..high(cache):
|
||||
cache[i] = nil
|
||||
proc resetRopeCache* =
|
||||
for i in low(cache)..high(cache):
|
||||
cache[i] = nil
|
||||
|
||||
proc ropeInvariant(r: Rope): bool =
|
||||
if r == nil:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue