mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 05:20:31 +00:00
cache rope when threads are enabled (#19981)
* cache rope * add threadvar
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user