Citat af Marcel Keller <mkel...@cs.au.dk>:
Hi friends of VIFF,
I've implemented Share and ShareList in C, based on a C implementation
of Deferred. Using the C extension, benchmark.py and aes.py show a speed
up between 50 and 100 percent.
This is very nice, but not entirely surprising I think. I believe this
other MPC project that claimed to be much faster than VIFF was also
written in C. There is simply much room for optimization, and you can
probably imagine that having everything written in highly optimized C
code would make it faster still.
Their reasoning, on the other hand, was that the asymptotic nature of
VIFF was causing it to be slower. I am still not convinced about that.
The code is in my repository: http://hg.viff.dk/mkeller
To use the extension, first compile and install it:
$ python setup.py install [--prefix PREFIX]
Then, add the following lines two to your program before importing
anything from viff or twisted:
import viff.boost
viff.boost.install(with_viff_reactor=<True|False>)
If the parameter is True, the VIFF reactor is also installed, so this
doesn't have to be done separately.
There is a notable difference to the standard implementation of
Deferred: Errbacks are disabled and exceptions raised in callbacks are
not caught. This is for the following reasons:
- The implementation was inefficient (too many isinstance() calls).
- Errbacks are only used for error reporting in VIFF. However, I prefer
VIFF to crash (and print a traceback) immediately if there is an
exception instead of wrapping the exception and reporting it later,
which makes debugging harder.
Honestly I would too. That said, I haven't really been debugging VIFF
so who am I to argue :)
I'm open for comments on this issue. It shouldn't be hard to reimplement
errbacks or to implement something different like a global errback. For
compatibility, all Deferred methods are still present.
If trial is modified to load the C extension, all tests succeed except a
few doctests.
Best regards,
Marcel
_______________________________________________
viff-devel mailing list (http://viff.dk/)
viff-devel@viff.dk
http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk
_______________________________________________
viff-devel mailing list (http://viff.dk/)
viff-devel@viff.dk
http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk