tslow_tables.nim 415 B

12345678910111213141516171819202122232425262728293031
  1. discard """
  2. timeout: "7"
  3. action: "compile"
  4. nimout: '''create
  5. search
  6. done'''
  7. """
  8. # bug #12195
  9. import tables
  10. type Flop = object
  11. a: array[128, int] # <-- compile time is proportional to array size
  12. proc hop(): bool =
  13. var v: Table[int, Flop]
  14. echo "create"
  15. for i in 1..1000:
  16. v.add i, Flop()
  17. echo "search"
  18. for i in 1..1000:
  19. discard contains(v, i)
  20. echo "done"
  21. const r {.used.} = hop()