Skip to content

Commit bbd7d16

Browse files
committed
Speed gtdot; allow gstack to work with many tasks
1 parent 6601c3f commit bbd7d16

3 files changed

Lines changed: 9 additions & 39 deletions

File tree

script/testgahhr.ijs

Lines changed: 0 additions & 31 deletions
This file was deleted.

test/gstack.ijs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,13 @@ end.
122122
if. IF64 do.
123123
assert. (<@i."0 i. 5) -: (i. t. ''"0 i. 5)
124124
assert. 2 <: 1 T. ''
125-
while. 2 > # 2 T. '' do. end. NB. wait till threads become ready
126-
assert. 1 2 *./@e. 2 T. ''
127-
assert. 0 1 2 *./@e. > (3&T.@'')@(6!:3) t.'' "(0) 0.1 0.1 0.3
128-
assert. 0 1 2 *./@e. > (3&T.@'')@(6!:3) t.'' "(0) 0.3 0.3 0.1
129-
assert. (_1000;1 2;_1001) e.~&> 4 T. (3&T.@'')@(6!:3) t.'' "(0) 0.2 0.6 0.4
130-
while. 2 ~: # 2 T. '' do. end. NB. wait till threads become ready
125+
nwthreads=. 1 T. ''
126+
while. nwthreads ~: # 2 T. '' do. end. NB. wait till threads become ready
127+
assert. (>: i. nwthreads) *./@e. 2 T. ''
128+
assert. (>: i. nwthreads) *./@e. > (3&T.@'')@(6!:3) t.'' "(0) (nwthreads # 0.1), 0.3
129+
assert. (>: i. nwthreads) *./@e. > (3&T.@'')@(6!:3) t.'' "(0) (nwthreads # 0.3), 0.1
130+
assert. (((<_1000) #~ <: nwthreads),(>: i. nwthreads);_1001) e.~&> 4 T. (3&T.@'')@(6!:3) t.'' "(0) (0.3 #~ <: nwthreads), 0.6 0.4
131+
while. nwthreads ~: # 2 T. '' do. end. NB. wait till threads become ready
131132
NB. semaphore test
132133
localpyx=.5 T. 5
133134
g t. '' localpyx;<1

test/gtdot.ijs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ assert. r e. _1000 _1001 NB. _1001 if run on the main thread
5050

5151
g=: 3 : 0
5252
9!:1[(7^5)+3 T.'' NB. random per thread
53-
6!:3[?0 NB. arbitrary delay
53+
6!:3[0.3*?0 NB. arbitrary delay
5454
1
5555
)
5656

5757
g1=: 3 : 0
5858
9!:1[(7^5)-3 T.'' NB. random per thread
5959
for_i. i.%:N1 do.
60-
6!:3[?0
60+
6!:3[0.3*?0
6161
pyx=. g t.'' "0 i.%:N1
6262
end.
6363
]&> pyx

0 commit comments

Comments
 (0)