changeset 1282:7265daadaa63

It is more flexible if we use strings to define operations and then look them up in the runtime.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Fri, 16 Oct 2009 15:57:56 +0200
parents bced13257ba4
children 9043758a351a
files apps/benchmark.py apps/benchmark_classes.py
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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, 
--- 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