remove when declared(cache); cache is always there (#19991)
This commit is contained in:
parent
e8ee2f9c2a
commit
ed2bf02a51
1 changed files with 6 additions and 9 deletions
|
|
@ -111,16 +111,13 @@ var gCacheMisses* = 0
|
||||||
var gCacheIntTries* = 0
|
var gCacheIntTries* = 0
|
||||||
|
|
||||||
proc insertInCache(s: string): Rope =
|
proc insertInCache(s: string): Rope =
|
||||||
when declared(cache):
|
inc gCacheTries
|
||||||
inc gCacheTries
|
var h = hash(s) and high(cache)
|
||||||
var h = hash(s) and high(cache)
|
result = cache[h]
|
||||||
result = cache[h]
|
if isNil(result) or result.data != s:
|
||||||
if isNil(result) or result.data != s:
|
inc gCacheMisses
|
||||||
inc gCacheMisses
|
|
||||||
result = newRope(s)
|
|
||||||
cache[h] = result
|
|
||||||
else:
|
|
||||||
result = newRope(s)
|
result = newRope(s)
|
||||||
|
cache[h] = result
|
||||||
|
|
||||||
proc rope*(s: string): Rope =
|
proc rope*(s: string): Rope =
|
||||||
## Converts a string to a rope.
|
## Converts a string to a rope.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue