Callbacks from C into Squeak
David T. Lewis
lewis at mail.msen.com
Mon Dec 18 14:03:53 UTC 2006
On Mon, Dec 18, 2006 at 10:11:46AM +0000, dan wrote:
> David T. Lewis wrote:
> >Here is the test that I ran:
> > | sendPipe receivePipe s remote count |
> > count := 1000000. "One million transactions"
> > sendPipe := OSPipe blockingPipe.
> > receivePipe := OSPipe blockingPipe.
> > remote := UnixProcess forkHeadlessSqueakAndDoThenQuit:
> > ["This block is evaluated in the remote headless Squeak image"
> > (count + 1) timesRepeat:
> > ["Read message and echo it back to sender"
> > s := sendPipe next: 5.
> > receivePipe nextPutAll: s; flush]].
> > remote inspect. "Inspect the process proxy for the remote Squeak"
> > sendPipe nextPutAll: 'hello'; flush.
> > receivePipe next: 5. "do one complete transaction before starting the
> > timer"
> > (Time millisecondsToRun:
> > [count timesRepeat:
> > [sendPipe nextPutAll: 'hello'; flush.
> > receivePipe next: 5]]) inspect. "Inspect run time in
> > milliseconds"
> > sendPipe close.
> > receivePipe close.
> Hi Dave
> That makes it an overhead 0.15ms per callback, which is acceptable. I
> will need to pass back an forth a packed array of floating point numbers
> with a few hundred elements in it (representing the state of the system
> and its calculated derivative). How could that be achieved without
> denting that 0.15ms overhead too much?
The only way to find out is to try it. Do you have an example of the
packed array binary data to work with? We could plug it in to the test
and see what happens.
More information about the Squeak-dev