/rev/7265daadaa63
changeset: 1282:7265daadaa63
user:      Janus Dam Nielsen <[email protected]>
date:      Fri Oct 16 15:57:56 2009 +0200
summary:   It is more flexible if we use strings to define operations and then 
look them up in the runtime.

diffstat:

 apps/benchmark.py         |  8 ++++----
 apps/benchmark_classes.py |  2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diffs (30 lines):

diff -r bced13257ba4 -r 7265daadaa63 apps/benchmark.py
--- a/apps/benchmark.py Fri Oct 16 15:54:29 2009 +0200
+++ b/apps/benchmark.py Fri Oct 16 15:57:56 2009 +0200
@@ -85,10 +85,10 @@
 
 last_timestamp = time.time()
 
-operations = {"mul": (operator.mul, [], BinaryOperation),
-              "compToft05": (operator.ge, [ComparisonToft05Mixin], 
BinaryOperation),
-              "compToft07": (operator.ge, [ComparisonToft07Mixin], 
BinaryOperation),
-              "eq": (operator.eq, [ProbabilisticEqualityMixin], 
BinaryOperation)}
+operations = {"mul"       : ("mul", [], BinaryOperation),
+              "compToft05": ("ge", [ComparisonToft05Mixin], BinaryOperation),
+              "compToft07": ("ge", [ComparisonToft07Mixin], BinaryOperation),
+              "eq"        : ("eq", [ProbabilisticEqualityMixin], 
BinaryOperation)}
 
 runtimes = {"PassiveRuntime": PassiveRuntime,
             "PaillierRuntime": PaillierRuntime, 
diff -r bced13257ba4 -r 7265daadaa63 apps/benchmark_classes.py
--- a/apps/benchmark_classes.py Fri Oct 16 15:54:29 2009 +0200
+++ b/apps/benchmark_classes.py Fri Oct 16 15:57:56 2009 +0200
@@ -51,7 +51,7 @@
 
     def __init__(self, rt, operation, field, count):
         self.rt = rt
-        self.operation = operation
+        self.operation = getattr(rt, operation)
         self.pc = None
         self.field = field
         self.count = count
_______________________________________________
viff-commits mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-commits-viff.dk

Reply via email to