hey everyone
i just recompiled this practice https://github.com/dom96/nim-in-action-code/blob/master/Chapter6/WikipediaStats/parallel_counts.nim
the result was almost 5x slower
with orc i got this warn/error : SIGSEGV: Illegal storage access. (Attempt to read from nil?)
i tried orc / arc / also with danger flag , the result was so slow
(with previous GC i was getting 1.1 sec) (now with arc or orc im getting 5.2 sec)
seems , some bugs ? or overhead ?
tnx a lot
nim c -d:release -d:useMalloc --gc:arc --threads:on fun_threads_parallel.nim
and
nim c -d:release -d:useMalloc --gc:orc --threads:on fun_threads_parallel.nim
gave me same performance like previous GC (without --gc flag)
BTW, with orc the Error/Warnning remains: SIGSEGV: Illegal storage access. (Attempt to read from nil?)
with arc , seems everything work fine,(or silently leaking?)
another way to reach the same speed with arc (without useMalloc) is to remove the allocations entirely.
if the iterator splitLines returned a view instead of a copy:
iterator splitLines(s: string,keepEol=false):openArray[char]
#...body identical except
#yield substr(s,first, if keepEol: last-1 else: eolpos-1)
yield s.toOpenArray(first, if keepEol: last-1 else: eolpos-1)
and all the other stdlib string procs accepted openArray[char] instead of string (no other changes necessary)
#all in parseutils.nim
proc fastSubstr(...
proc parseUntil(...
proc rawParseInt(...
proc parseBiggestInt(...
proc parseInt(...
with this, and gc:arc, i get 6,065 allocs and 6,056 frees (431MiB total) versus 7,162,164 allocs and 7,162,155 frees (916MiB total)
and the expected performance, without useMalloc