On Mon, Feb 25, 2008 at 7:01 AM, didier deshommes <[EMAIL PROTECTED]> wrote:
>
> On Sat, Feb 23, 2008 at 1:24 PM, William Stein <[EMAIL PROTECTED]> wrote:
> > I'm actually pretty curious about how pexpect and XMLRPC both
> > done locally compare speedwise. I've done some simple benchmarks
> > below. The short answer is that pexpect is between several hundred
> > to several thousand times faster than XMLRPC, depending on the
> > platform.
>
> More benchmarks:
> pyxmlrpc (http://sourceforge.net/projects/py-xmlrpc/) is a c
> implementation that is roughly 2 times faster than xmlrpclib on small
> inputs. Here are some numbers on linux running sage 2.10.1:
>
> pyxmlrpc:
> sage: %timeit ("c.execute('add', [2r, 3r])")
> 1000000 loops, best of 3: 65.8 ns per loop
> sage: timeit c.execute('add', [2r, 3r])
> 1000 loops, best of 3: 1.46 ms per loop
>
>
> xmlrpclib:
> sage: %timeit ("s.add([2r,3r])")
> 1000000 loops, best of 3: 158 ns per loop
> sage: timeit s.add([2r,3r])
> 100 loops, best of 3: 1.94 ms per loop
>
>
> overall:
> sage: time for _ in range(10^3): gp.eval('2+3')
> CPU times: user 0.34 s, sys: 0.10 s, total: 0.45 s
> Wall time: 0.82
Thanks. What are you timing this on? On sage.math the
same benchmark is consistently much faster:
sage: time for _ in range(10^3): gp.eval('2+3')
CPU times: user 0.09 s, sys: 0.05 s, total: 0.14 s
Wall time: 0.15
I just tried using a for loop instead of timeit to
time using xmlrpc (exactly as in
http://docs.python.org/lib/simple-xmlrpc-servers.html)
and the timing on sage.math is:
sage: time for _ in range(10^3): s.add(2r,3r)
CPU times: user 0.66 s, sys: 0.35 s, total: 1.01 s
Wall time: 1.41
This is exactly a factor of 10 difference in speed
(in favor of pexpect). This is *not* what I claimed
in my initial benchmark, which was wrong -- my apologies
again -- benchmarking libraries one has never used before
is always tricky. Still 10 times faster is a lot faster.
In your benchmark pexpect is only twice as fast
as c-xml and only 3 times faster than python xml.
Summary: pexpect is anywhere between 2 and
10 times faster than xmlrpc depending on machine and
xml implementation.
Thanks Didier!
> sage: time for _ in range(10^3): c.execute('add', [2r, 3r])
> CPU times: user 0.08 s, sys: 0.02 s, total: 0.10 s
> Wall time: 1.66
>
> sage: time for _ in range(10^3): s.add([2r,3r])
> CPU times: user 0.99 s, sys: 0.38 s, total: 1.37 s
> Wall time: 2.51
>
> Note: The pyxmlrpc is currently unmaintained (last realease was in
> 2004) and needs to be patched against 2.5 (there's a fix at the bottom
> of
> http://sourceforge.net/tracker/index.php?func=detail&aid=1734819&group_id=23992&atid=380301).
>
>
>
> didier
>
> >
>
--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---