summary refs log tree commit diff stats
path: root/tests/vm/tslow_tables.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/vm/tslow_tables.nim')
-rw-r--r--tests/vm/tslow_tables.nim30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/vm/tslow_tables.nim b/tests/vm/tslow_tables.nim
new file mode 100644
index 000000000..e40187f18
--- /dev/null
+++ b/tests/vm/tslow_tables.nim
@@ -0,0 +1,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()
+