From fc4a548d6f715a1502e0d5eff1b679e79f8cf243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 16 Feb 2015 15:26:54 +0100 Subject: ManyFunctions performance test: ~200 functions in a contract, half of them are called randomly --- ManyFunctionsGenerator.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ManyFunctionsGenerator.py (limited to 'ManyFunctionsGenerator.py') diff --git a/ManyFunctionsGenerator.py b/ManyFunctionsGenerator.py new file mode 100644 index 00000000..93eef784 --- /dev/null +++ b/ManyFunctionsGenerator.py @@ -0,0 +1,24 @@ + +n = 100 + +splitNumBegin = 128 - (n / 2) +i = 1 + +template = """ + function right{0}(uint seed) returns (uint) {{ + var r = nextRand(seed); + if (r >= 2^{2}) + return right{1}(r); + return left{1}(r); + }} + + function left{0}(uint seed) returns (uint) {{ + var r = nextRand(nextRand(seed)); + if (r >= 2^{2}) + return left{1}(r); + return right{1}(r); + }} +""" + +for i in range(1, n): + print template.format(i, i + 1, i + splitNumBegin) \ No newline at end of file -- cgit v1.2.3 From 20ed953910f5298b9b7852413ef916150646723b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 17 Feb 2015 13:28:58 +0100 Subject: ManyFunctions performance test: replace xor with correct exp operator --- ManyFunctionsGenerator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ManyFunctionsGenerator.py') diff --git a/ManyFunctionsGenerator.py b/ManyFunctionsGenerator.py index 93eef784..b4f36af0 100644 --- a/ManyFunctionsGenerator.py +++ b/ManyFunctionsGenerator.py @@ -7,14 +7,14 @@ i = 1 template = """ function right{0}(uint seed) returns (uint) {{ var r = nextRand(seed); - if (r >= 2^{2}) + if (r >= 2**{2}) return right{1}(r); return left{1}(r); }} function left{0}(uint seed) returns (uint) {{ var r = nextRand(nextRand(seed)); - if (r >= 2^{2}) + if (r >= 2**{2}) return left{1}(r); return right{1}(r); }} -- cgit v1.2.3