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
This commit is contained in:
Miran 2020-03-30 13:18:12 +02:00 • committed by GitHub
commit 8088633250
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 532 additions and 1082 deletions

View file

@ -25,11 +25,11 @@ proc emitter() =
spawn emitter()
# At this point emitter should be stuck in `send`
sleep(100) # Sleep a bit to ensure that it is still stuck
sleep(50) # Sleep a bit to ensure that it is still stuck
doAssert(not msgSent)
spawn receiver()
sleep(100) # Sleep a bit to let receicer consume the messages
sleep(50) # Sleep a bit to let receicer consume the messages
doAssert(msgSent) # Sender should be unblocked
doAssert(chan.trySend(4))

View file

@ -51,12 +51,11 @@ proc convex_hull[T](points: var seq[T], cmp: proc(x, y: T): int {.closure.}) : s
ul[k] = spawn half[T](points, k == 0)
result = concat(^ul[0], ^ul[1])
var s = map(toSeq(0..99999), proc(x: int): Point = (float(x div 1000), float(x mod 1000)))
var s = map(toSeq(0..9999), proc(x: int): Point = (float(x div 100), float(x mod 100)))
# On some runs, this pool size reduction will set the "shutdown" attribute on the
# worker thread that executes our spawned task, before we can read the flowvars.
setMaxPoolSize 2
#echo convex_hull[Point](s, cmpPoint)
for i in 0..5:
for i in 0..2:
doAssert convex_hull[Point](s, cmpPoint) ==
@[(0.0, 0.0), (99.0, 0.0), (99.0, 999.0), (0.0, 999.0)]
@[(0.0, 0.0), (99.0, 0.0), (99.0, 99.0), (0.0, 99.0)]

View file

@ -1,18 +1,54 @@
discard """
output: '''13 abc'''
output: '''
13 abc
called deepCopy for int
called deepCopy for int
done999 999
'''
"""
type
PBinaryTree = ref object
le, ri: PBinaryTree
value: int
import threadpool
block one:
type
PBinaryTree = ref object
le, ri: PBinaryTree
value: int
proc main =
var x: PBinaryTree
deepCopy(x, PBinaryTree(ri: PBinaryTree(le: PBinaryTree(value: 13))))
var y: string
deepCopy y, "abc"
echo x.ri.le.value, " ", y
main()
proc main =
var x: PBinaryTree
deepCopy(x, PBinaryTree(ri: PBinaryTree(le: PBinaryTree(value: 13))))
var y: string
deepCopy y, "abc"
echo x.ri.le.value, " ", y
block two:
type
Bar[T] = object
x: T
main()
proc `=deepCopy`[T](b: ref Bar[T]): ref Bar[T] =
result.new
result.x = b.x
when T is int:
echo "called deepCopy for int"
else:
echo "called deepCopy for something else"
proc foo(b: ref Bar[int]): int = 999
# test that the disjoint checker deals with 'a = spawn f(); g = spawn f()':
proc main =
var dummy: ref Bar[int]
new(dummy)
dummy.x = 44
#parallel:
let f = spawn foo(dummy)
let b = spawn foo(dummy)
echo "done", ^f, " ", ^b
main()

View file

@ -1,7 +1,9 @@
discard """
output: '''called deepCopy for int
output: '''
called deepCopy for int
done999 999'''
called deepCopy for int
done999 999
'''
"""
import threadpool

View file

@ -2,20 +2,49 @@ discard """
outputsub: "EVEN 28"
"""
import threadpool
import threadpool, locks
proc odd(a: int) = echo "ODD ", a
proc even(a: int) = echo "EVEN ", a
block one:
proc odd(a: int) = echo "ODD ", a
proc even(a: int) = echo "EVEN ", a
proc main() =
var a: array[0..30, int]
for i in low(a)..high(a): a[i] = i
parallel:
var i = 0
while i <= 29:
spawn even(a[i])
spawn odd(a[i+1])
inc i, 2
# is correct here
proc main() =
var a: array[0..30, int]
for i in low(a)..high(a): a[i] = i
parallel:
var i = 0
while i <= 29:
spawn even(a[i])
spawn odd(a[i+1])
inc i, 2
# is correct here
main()
main()
block two:
var echoLock: Lock
initLock echoLock
proc f(a: openArray[int]) =
for x in a:
withLock echoLock:
echo x
proc f(a: int) =
withLock echoLock:
echo a
proc main() =
var a: array[0..9, int] = [0,1,2,3,4,5,6,7,8,9]
parallel:
spawn f(a[0..2])
#spawn f(a[16..30])
var i = 3
while i <= 8:
spawn f(a[i])
spawn f(a[i+1])
inc i, 2
# is correct here
main()

View file

@ -1,40 +0,0 @@
discard """
output: '''0
1
2
3
4
5
6
7
8'''
sortoutput: true
"""
import threadpool, locks
var echoLock: Lock
initLock echoLock
proc f(a: openArray[int]) =
for x in a:
withLock echoLock:
echo x
proc f(a: int) =
withLock echoLock:
echo a
proc main() =
var a: array[0..9, int] = [0,1,2,3,4,5,6,7,8,9]
parallel:
spawn f(a[0..2])
#spawn f(a[16..30])
var i = 3
while i <= 8:
spawn f(a[i])
spawn f(a[i+1])
inc i, 2
# is correct here
main()

View file

@ -26,10 +26,10 @@ proc greet(p:Person) =
" friend:", p.friend.name, "(", cast[int](addr p.friend.name),") }"
proc setup =
for i in 0 ..< 20:
for i in 0 ..< 10:
people.add newPerson("Person" & $(i + 1))
for i in 0 ..< 20:
people[i].friend = people[19-i]
for i in 0 ..< 10:
people[i].friend = people[9-i]
proc update =
parallel:

View file

@ -17,9 +17,9 @@ import tables
type
Base* = ref object of RootObj
someSeq: seq[int]
baseData: array[400000, byte]
baseData: array[40000, byte]
Derived* = ref object of Base
data: array[400000, byte]
data: array[40000, byte]
type
ThreadPool = ref object

View file

@ -3,7 +3,7 @@ discard """
"""
# bug #7638
import threadpool, os, strformat
import threadpool, os
proc timer(d: int): int =
#echo fmt"sleeping {d}"
@ -11,7 +11,7 @@ proc timer(d: int): int =
#echo fmt"done {d}"
return d
var durations = [1000, 1500, 2000, 2500, 3000]
var durations = [1000, 1500, 2000]
var tasks: seq[FlowVarBase] = @[]
var results: seq[int] = @[]
@ -25,11 +25,9 @@ while index != -1:
#echo repr results
index = blockUntilAny(tasks)
doAssert results.len == 5
doAssert results.len == 3
doAssert 1000 in results
doAssert 1500 in results
doAssert 2000 in results
doAssert 2500 in results
doAssert 3000 in results
sync()
echo "true"