timotheecour / Nim

Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance (in that order of priority).
http://nim-lang.org/
Other
2 stars 0 forks source link

tables misc #82

Open timotheecour opened 4 years ago

timotheecour commented 4 years ago

links

timotheecour commented 4 years ago

D20200428T185548 the PR (Unwind just the "pseudorandom probing" part of recent sets,tables changes by c-blake · Pull Request #13816 · nim-lang/Nim) that reverted my tables pseudorandom work causes a number of speed regressions eg:

timotheecour commented 4 years ago

5X slower

(using -d:danger for timing)

import tables
import times
proc main=
  var
    map = initTable[int, int]()

  for i in 0..<10_000_000:
    map[i] = i
  for i in 0..<3:
    for j in 0..<10_000_000:
      map[j] = map[j] + 1
let t = cpuTime()
main()
let t2 = cpuTime() - t
echo t2
doAssert t2 < 1.0
timotheecour commented 4 years ago
timotheecour commented 4 years ago
timotheecour commented 3 years ago

performance impact of auto-initializing?

refs: https://github.com/nim-lang/Nim/pull/11094#issuecomment-773859654 https://github.com/nim-lang/RFCs/issues/101#issuecomment-418044191

For 64-element tables, the change seems to make the whole benchmark about 4% slower.