summary refs log blame commit diff stats
path: root/tests/vm/tslow_tables.nim
blob: a933021e0fea1a8112d1504e921fc0d1b2d6dc65 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
           
              










                   
                                                                      















                          
discard """
  timeout: "5"
  action: "compile"
  nimout: '''create
search
done'''
"""

# bug #12195

import tables

type Flop = object
  a: array[128, int]  # <-- compile time is proportional to array size

proc hop(): bool =
  var v: Table[int, Flop]

  echo "create"
  for i in 1..1000:
    v.add i, Flop()

  echo "search"
  for i in 1..1000:
    discard contains(v, i)

  echo "done"

const r = hop()