summary refs log tree commit diff stats
path: root/tests/vm/tslow_tables.nim
blob: e40187f18dfaf97821356f68f9fbfef9009c7030 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
discard """
  timeout: "7"
  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 {.used.} = hop()