diff options
author | Araq <rumpf_a@web.de> | 2013-01-09 08:44:20 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-01-09 08:44:20 +0100 |
commit | c9690864d4cf9945cb5eb9497f7621e56f9bebd0 (patch) | |
tree | 2e6dba7bf42ba3a8574b071d9ccabf43612be58d /compiler/ropes.nim | |
parent | 86b19c44eba8a1572feaeb47f039e5da5478720a (diff) | |
download | Nim-c9690864d4cf9945cb5eb9497f7621e56f9bebd0.tar.gz |
optimized ropes work now but no speedup
Diffstat (limited to 'compiler/ropes.nim')
-rwxr-xr-x | compiler/ropes.nim | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/ropes.nim b/compiler/ropes.nim index f27bf70f7..95dce8278 100755 --- a/compiler/ropes.nim +++ b/compiler/ropes.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2012 Andreas Rumpf +# (c) Copyright 2013 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -68,7 +68,7 @@ type # though it is not necessary) when true: - # working version: + # old version: type PRope* = ref TRope TRope*{.acyclic.} = object of TObject # the empty rope is represented @@ -330,7 +330,7 @@ when true: result = false else: - # optimized but broken version: + # optimized version with 'unsafeNew': type PRope* = ref TRope @@ -480,7 +480,9 @@ else: it = it.left assert(it != nil) assert(it.L < 0) - write(f, cstring(it.d), -it.L) + let L = -it.L + if writeBuffer(f, cstring(it.d), L) != L: + InternalError("cannot store file") proc WriteRope*(head: PRope, filename: string, useWarning = false) = var f: tfile |