Re: [viff-devel] Say hello to viff.boost
Hi friends of VIFF, my repository now also features a C implementation of viff.field. It uses GMP in GFElement. The benchmarks show a speed up between 100 and over 200 percent (the latter in multiplication triple generation with hyperinvertible matrices). The instructions to use it are the same. Best regards, Marcel Marcel Keller wrote: 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. 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=) 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. 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
Re: [viff-devel] Say hello to viff.boost
Citat af Marcel Keller : 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=) 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
[viff-devel] Say hello to viff.boost
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. 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=) 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. 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