I have implemented a first version of mailboxes. It is still in very much
alpha stage, like the rest of the code discussed during these weeks, but a
simple example seems to work
(defun test-mailbox (nwriters &optional (messages 1000))
(declare (optimize (safety 0)))
(let* ((barrier (mp:make-barrier t :name 13))
(writer-messages (the fixnum (round messages nwriters)))
(total-messages (the fixnum (* writer-messages nwriters)))
(mailbox (mp:make-mailbox))
(reader (mp:process-run-function
:reader
#'(lambda ()
(mp:barrier-wait barrier)
(time
(loop for i of-type fixnum from 0 below total-messages
do (mp:mailbox-read mailbox))))))
(writers (loop for i from 0 below nwriters
do (mp:process-run-function
i
#'(lambda ()
(mp:barrier-wait barrier)
(loop for i of-type fixnum from 0 below writer-messages
do (mp:mailbox-send mailbox i)))))))
(mp:barrier-unblock barrier :disable t)
(mp:process-join reader)))
Figures are not that bad either, are they?
> (test-mailbox 10 100000)
real time : 0.319 secs
run time : 0.062 secs
gc count : 1 times
consed : 352 bytes
NIL
> (test-mailbox 1 100000)
real time : 0.018 secs
run time : 0.027 secs
gc count : 1 times
consed : 208 bytes
NIL
--
Instituto de FĂsica Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list