changeset 993:ed6a1c88de29

Merged.
author Martin Geisler <mg@daimi.au.dk>
date Thu, 02 Oct 2008 11:20:05 +0200
parents 13a883981248 35fc8a249a2a
children 383e6bfb4863
files viff/comparison.py viff/runtime.py
diffstat 4 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed Oct 01 14:09:26 2008 +0200
+++ b/.hgignore	Thu Oct 02 11:20:05 2008 +0200
@@ -22,6 +22,7 @@
 # Benchmarking data.
 profile.data
 *.prof
+*.pstats
 
 # LaTeX outputs.
 # *.{aux,dvi,log,nav,out,pdf,ps,snm,toc,vrb}
--- a/viff/comparison.py	Wed Oct 01 14:09:26 2008 +0200
+++ b/viff/comparison.py	Thu Oct 02 11:20:05 2008 +0200
@@ -80,8 +80,7 @@
         assert self.num_players + 2 < 2**l
 
         bits = [self.prss_share_bit_double(field) for _ in range(m)]
-        int_bits = [a for (a, _) in bits]
-        bit_bits = [b for (_, b) in bits]
+        int_bits, bit_bits = zip(*bits)
 
         def bits_to_int(bits):
             """Converts a list of bits to an integer."""
@@ -94,7 +93,7 @@
         a = share_a - share_b + 2**l
         T = self.open(2**t - int_b + a)
 
-        result = gather_shares([T] + bit_bits)
+        result = gather_shares((T,) + bit_bits)
         self.schedule_callback(result, self._finish_greater_than_equal, l)
         return result
 
--- a/viff/runtime.py	Wed Oct 01 14:09:26 2008 +0200
+++ b/viff/runtime.py	Thu Oct 02 11:20:05 2008 +0200
@@ -1126,7 +1126,7 @@
         # http://bugs.python.org/issue1375 since the start and stop
         # calls are in different stack frames.
         import hotshot
-        prof = hotshot.Profile("viff-%d.prof" % id)
+        prof = hotshot.Profile("player-%d.prof" % id)
         old_run = reactor.run
         def new_run(*args, **kwargs):
             print "Starting reactor with profiling"
@@ -1136,12 +1136,13 @@
             import hotshot.stats
             print "Loading profiling statistics...",
             sys.stdout.flush()
-            stats = hotshot.stats.load("viff-%d.prof" % id)
+            stats = hotshot.stats.load("player-%d.prof" % id)
             print "done."
             print
             stats.strip_dirs()
             stats.sort_stats("time", "calls")
             stats.print_stats(40)
+            stats.dump_stats("player-%d.pstats" % id)
         reactor.run = new_run
 
     # This will yield a Runtime when all protocols are connected.
--- a/viff/shamir.py	Wed Oct 01 14:09:26 2008 +0200
+++ b/viff/shamir.py	Thu Oct 02 11:20:05 2008 +0200
@@ -98,10 +98,9 @@
     Shares is a list of *threshold* + 1 ``(player id, share)`` pairs.
     Recombination is done in the optional point *x_recomb*.
     """
-    xs = [x_i for (x_i, _) in shares]
-    ys = [y_i for (_, y_i) in shares]
+    xs, ys = zip(*shares)
+    key = xs + (x_recomb, )
     try:
-        key = tuple(xs) + (x_recomb, )
         vector = _recombination_vectors[key]
     except KeyError:
         vector = []