summary refs log tree commit diff stats
path: root/tests/threads
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2020-03-30 13:18:12 +0200
committerGitHub <noreply@github.com>2020-03-30 13:18:12 +0200
commit8088633250872de8777c7078e636b2379780e107 (patch)
tree3ec6b06db9c970da5f9f2b80f1d7053c4021e34f /tests/threads
parent2a278f6eba5b154920177154bb48733268cacfc5 (diff)
downloadNim-8088633250872de8777c7078e636b2379780e107.tar.gz
faster CIs (#13803)
* ttables: smaller table, 5x speedup

* thavlak: less iterations, less loops; 30% speedup

* tasyncclosestall: shorter timeout; 35% speedup

* gcleak4: less iterations, 2x speedup

* ttimes: remove deprecated stuff

* tdangerisrelease: remove cpp backend, 3x speedup

* tfrexp1: smaller range, 2x speedup

* trtree: fix warnings, less iterations, 6x speedup

* tasyncawait_cyclebreaker: smaller swarm size; 2x speedup

* trealloc: smaller number of iterations; 10x speedup

* towned_binary_tree: less iterations, 4x speedup

* tclosure: remove unused code, less iterations; 2x speedup

* twaitany: less durations; 1.4x speedup

* tasync_misc: less iterations, 2x speedup

* t8535: smaller sleep, 1.5x speedup

* tmanyjoin: smaller sleep, 2x speedup

* t12221: shorter sleeps, removed two slower tests; 1.6x speedup

* tfuturestream: smaller sleep; 1.5x speedup

* growobjcrash: less iterations; 2x speedup

* ttryrecv: smaller sleep; 1.5x speedup

* treusetvar: less threads; 2x speedup

* delete tthreadanalysis2, basically a duplicate of tthreadanalysis

* t7758: less iterations, 1.5x speedup

* tasyncawait: smaller swarm, less messages; 1.5x speedup

* tjsandnativeasync: smaller sleep, 1.5x speedup

* tpendingcheck: smaller sleep, 1.5x speedup

* remove rodfiles test category

* move tseq from its own category to 'collections' category

* remove unneeded tests and helpers from 'assert' category

* stdlib: merge tbitops2 into tbitops

* remove 'trepr2' from 'stdlib' cat

* merge 'tstreams' into one file

* remove 'tinefficient_const_table' from 'ccbugs' cat

* merge 'tcollections_to_string' into 'tcollections'

* tblocking_channel: smaller sleep, small speedup

* tconvexhull: less iterartions; 1.2x speedup

* merge 'tdeepcopy2' into 'tdeepcopy'

* merge 'tdisjoint_slice2' into 'tdisjoint_slice1'

* tmissing_deepcopy: smaller sequence

* tsendtwice: smaller arrays; 5x speedup

* remove 'tindexerrorformatbounds'

* disable multimethod tests

* remove 'gc:none' and 'refc' without 'd:useRealtimeGC' from gc tests

* koch.nim: bootstrap just with '-d:release', no need for 'csource'

* add github workflow for documentation

* testament: no need for 8 sub-second decimals
Diffstat (limited to 'tests/threads')
-rw-r--r--tests/threads/t8535.nim2
-rw-r--r--tests/threads/tmanyjoin.nim2
-rw-r--r--tests/threads/treusetvar.nim6
-rw-r--r--tests/threads/tthreadanalysis2.nim51
-rw-r--r--tests/threads/ttryrecv.nim2
5 files changed, 6 insertions, 57 deletions
diff --git a/tests/threads/t8535.nim b/tests/threads/t8535.nim
index dfc95547d..1af11f9ad 100644
--- a/tests/threads/t8535.nim
+++ b/tests/threads/t8535.nim
@@ -22,7 +22,7 @@ import asyncdispatch
 import threadpool
 
 proc f1() =
-  waitFor sleepAsync(100)
+  waitFor sleepAsync(20)
   echo "hello"
 
 spawn f1()
diff --git a/tests/threads/tmanyjoin.nim b/tests/threads/tmanyjoin.nim
index 2c1cda494..aca284965 100644
--- a/tests/threads/tmanyjoin.nim
+++ b/tests/threads/tmanyjoin.nim
@@ -12,7 +12,7 @@ type
 
 const
   ThreadsCount = 129
-  SleepTime = 1000
+  SleepTime = 250
 
 proc worker(p: Marker) {.thread.} =
   acquire(p.lock)
diff --git a/tests/threads/treusetvar.nim b/tests/threads/treusetvar.nim
index 672da6bdd..2b0017595 100644
--- a/tests/threads/treusetvar.nim
+++ b/tests/threads/treusetvar.nim
@@ -1,8 +1,8 @@
 discard """
-  outputsub: "129"
+  outputsub: "65"
 """
 
-import os, locks
+import locks
 
 type
   MarkerObj = object
@@ -11,7 +11,7 @@ type
   Marker = ptr MarkerObj
 
 const
-  ThreadsCount = 129
+  ThreadsCount = 65
 
 proc worker(p: Marker) {.thread.} =
   acquire(p.lock)
diff --git a/tests/threads/tthreadanalysis2.nim b/tests/threads/tthreadanalysis2.nim
deleted file mode 100644
index 067e186a8..000000000
--- a/tests/threads/tthreadanalysis2.nim
+++ /dev/null
@@ -1,51 +0,0 @@
-discard """
-  errormsg: "'threadFunc' is not GC-safe"
-  file: "tthreadanalysis2.nim"
-  line: 37
-  cmd: "nim $target --hints:on --threads:on $options $file"
-"""
-
-import os
-
-var
-  thr: array[0..5, Thread[tuple[a, b: int]]]
-
-proc doNothing() = discard
-
-type
-  PNode = ref TNode
-  TNode = object {.pure.}
-    le, ri: PNode
-    data: string
-
-var
-  root: PNode
-
-proc buildTree(depth: int): PNode =
-  if depth == 3: return nil
-  new(result)
-  result.le = buildTree(depth-1)
-  result.ri = buildTree(depth-1)
-  result.data = $depth
-
-proc echoLeTree(n: PNode) =
-  var it = n
-  while it != nil:
-    echo it.data
-    it = it.le
-
-proc threadFunc(interval: tuple[a, b: int]) {.thread.} =
-  doNothing()
-  for i in interval.a..interval.b:
-    var r = buildTree(i)
-    echoLeTree(r) # for local data
-  root = buildTree(2) # BAD!
-  #echoLeTree(root) # and the same for foreign data :-)
-
-proc main =
-  root = buildTree(5)
-  for i in 0..high(thr):
-    createThread(thr[i], threadFunc, (i*100, i*100+50))
-  joinThreads(thr)
-
-main()
diff --git a/tests/threads/ttryrecv.nim b/tests/threads/ttryrecv.nim
index 87dec6e79..cadf6c550 100644
--- a/tests/threads/ttryrecv.nim
+++ b/tests/threads/ttryrecv.nim
@@ -11,7 +11,7 @@ type PComm = ptr Channel[int]
 
 proc doAction(outC: PComm) {.thread.} =
   for i in 0 ..< 5:
-    sleep(rand(100))
+    sleep(rand(50))
     send(outC[], i)
 
 var