optimized ropes work now but no speedup
This commit is contained in:
parent
86b19c44eb
commit
c9690864d4
1 changed files with 6 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# The Nimrod Compiler
|
# The Nimrod Compiler
|
||||||
# (c) Copyright 2012 Andreas Rumpf
|
# (c) Copyright 2013 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
@ -68,7 +68,7 @@ type
|
||||||
# though it is not necessary)
|
# though it is not necessary)
|
||||||
|
|
||||||
when true:
|
when true:
|
||||||
# working version:
|
# old version:
|
||||||
type
|
type
|
||||||
PRope* = ref TRope
|
PRope* = ref TRope
|
||||||
TRope*{.acyclic.} = object of TObject # the empty rope is represented
|
TRope*{.acyclic.} = object of TObject # the empty rope is represented
|
||||||
|
|
@ -330,7 +330,7 @@ when true:
|
||||||
result = false
|
result = false
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# optimized but broken version:
|
# optimized version with 'unsafeNew':
|
||||||
|
|
||||||
type
|
type
|
||||||
PRope* = ref TRope
|
PRope* = ref TRope
|
||||||
|
|
@ -480,7 +480,9 @@ else:
|
||||||
it = it.left
|
it = it.left
|
||||||
assert(it != nil)
|
assert(it != nil)
|
||||||
assert(it.L < 0)
|
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) =
|
proc WriteRope*(head: PRope, filename: string, useWarning = false) =
|
||||||
var f: tfile
|
var f: tfile
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue