viff

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 diff
     1.1 --- a/apps/benchmark.py	Fri Oct 16 15:54:29 2009 +0200
     1.2 +++ b/apps/benchmark.py	Fri Oct 16 15:57:56 2009 +0200
     1.3 @@ -85,10 +85,10 @@
     1.4  
     1.5  last_timestamp = time.time()
     1.6  
     1.7 -operations = {"mul": (operator.mul, [], BinaryOperation),
     1.8 -              "compToft05": (operator.ge, [ComparisonToft05Mixin], BinaryOperation),
     1.9 -              "compToft07": (operator.ge, [ComparisonToft07Mixin], BinaryOperation),
    1.10 -              "eq": (operator.eq, [ProbabilisticEqualityMixin], BinaryOperation)}
    1.11 +operations = {"mul"       : ("mul", [], BinaryOperation),
    1.12 +              "compToft05": ("ge", [ComparisonToft05Mixin], BinaryOperation),
    1.13 +              "compToft07": ("ge", [ComparisonToft07Mixin], BinaryOperation),
    1.14 +              "eq"        : ("eq", [ProbabilisticEqualityMixin], BinaryOperation)}
    1.15  
    1.16  runtimes = {"PassiveRuntime": PassiveRuntime,
    1.17              "PaillierRuntime": PaillierRuntime, 
     2.1 --- a/apps/benchmark_classes.py	Fri Oct 16 15:54:29 2009 +0200
     2.2 +++ b/apps/benchmark_classes.py	Fri Oct 16 15:57:56 2009 +0200
     2.3 @@ -51,7 +51,7 @@
     2.4  
     2.5      def __init__(self, rt, operation, field, count):
     2.6          self.rt = rt
     2.7 -        self.operation = operation
     2.8 +        self.operation = getattr(rt, operation)
     2.9          self.pc = None
    2.10          self.field = field
    2.11          self.count = count