A Tango Fibers question and a functional programming anecdote.

downs default_357-line at yahoo.de
Sat Oct 27 22:06:00 PDT 2007


Here's a question to the tango devs.
I've been developing my own stackthreads (Fibers basically) library for
a while now, and finally got it working a few days ago.

Then we did some speed tests and discovered that it was about twice as
slow as Tango's Fiber implementation.

This prompted me to dig into the Fibers sourcecode, where I discovered
that Fibers doesn't backup ECX/EDX on context switch, and the FP
registers only on windows.

Now I am confused.

Could a knowledgeable tango dev kindly shed light on this issue? Why
isn't it necessary to save all registers on a context switch?

----
Now for the anecdote.
Today, at five in the morning, I wrote what I believe to be the first
purely functional D code with as little redundancy as possible in the
language.

>
> ["Load ", "Prefetch ", "Prefetch "] /zip/ ([0, 1, 2] /map/ (&info
/rfix/ currentComic /fix/ (&subtract!(int) /fix/ currentStrip))) /map/
&concat!(string) /zip/ [&update, &prefetch /fix/ (currentStrip-1),
&prefetch /fix/ (currentStrip-2)] /map/ &Pool.addTask;
>

So I looked at it, and for some _strange_ reason my eyes suddenly
started bleeding heavily.
That's when I knew I had overdone it on the templates again.
:)


PS: Here's the same code with some line breaks. But where's the fun in that?

>
> ["Load ", "Prefetch ", "Prefetch "] /zip/ (
>   [0, 1, 2] /map/ (
>     &info /rfix/ currentComic /fix/ (
>       &subtract!(int) /fix/ currentStrip
>       )
>     )
>   )
>   /map/ &concat!(string) /zip/ [
>     &update,
>     &prefetch /fix/ (currentStrip-1),
>     &prefetch /fix/ (currentStrip-2)
>   ] /map/ &Pool.addTask;
>



More information about the Digitalmars-d mailing list