[gambit-list] thread-send performance issue?
David St-Hilaire
sthilaid at iro.umontreal.ca
Thu Jan 22 15:49:53 EST 2009
Hi all!
I'm facing a weird situation... I tracked down in a program of mine a bottleneck
which came up to be a call to thread-send. After addint a (time ...) around it I
found that it takes around ~20 ms to perform the thread send (which I believe is
pretty slow):
(time (thread-send user-interface-thread `(redraw ,level)))
24 ms real time
20 ms cpu time (10 user, 10 system)
1 collection accounting for 2 ms real time (0 user, 0 system)
40536 bytes allocated
no minor faults
no major faults
(time (thread-send user-interface-thread `(redraw ,level)))
18 ms real time
10 ms cpu time (10 user, 0 system)
no collections
37900 bytes allocated
no minor faults
no major faults
I'd like to note here that level in the code sample above is a rather big data
structure, but I believe this is irrelevant because only the pointer should be
passed down?
Strangely, I tried to reproduced the behaviour in a repl but I only happened to
get ~0ms for these thread-send calls:
> (define t (make-thread (lambda () (let loop () (pp (thread-receive)) (loop)))))
> (thread-start! t)
#<thread #2>
> (time (thread-send t 'allo))
(time (thread-send t 'allo))
0 ms real time
0 ms cpu time (0 user, 0 system)
no collections
24 bytes allocated
no minor faults
no major faults
> allo
(time (thread-send t 'allo))
(time (thread-send t 'allo))
0 ms real time
0 ms cpu time (0 user, 0 system)
no collections
24 bytes allocated
no minor faults
no major faults
> allo
Thank you very much for your help!
David
More information about the Gambit-list
mailing list