summaryrefslogtreecommitdiffstats
path: root/Wrappers
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-06-13 11:06:47 +0100
committerEdoardo Pasca <edo.paskino@gmail.com>2019-06-13 11:06:47 +0100
commit3352510df0967c79eb9d06f9e024c8fdcdacd677 (patch)
treea08fb2da9a830aa2892b296d65465e729e3b4b1e /Wrappers
parente0968ac0dee1b8a46bfd75a357df704118ad05a7 (diff)
downloadframework-3352510df0967c79eb9d06f9e024c8fdcdacd677.tar.gz
framework-3352510df0967c79eb9d06f9e024c8fdcdacd677.tar.bz2
framework-3352510df0967c79eb9d06f9e024c8fdcdacd677.tar.xz
framework-3352510df0967c79eb9d06f9e024c8fdcdacd677.zip
test binary divide speedup is tested on 10 consecutive divisions
Diffstat (limited to 'Wrappers')
-rwxr-xr-xWrappers/Python/test/test_DataContainer.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/Wrappers/Python/test/test_DataContainer.py b/Wrappers/Python/test/test_DataContainer.py
index 4c53df8..7234167 100755
--- a/Wrappers/Python/test/test_DataContainer.py
+++ b/Wrappers/Python/test/test_DataContainer.py
@@ -324,16 +324,19 @@ class TestDataContainer(unittest.TestCase):
ds = DataContainer(a, False, ['X', 'Y', 'Z'])
ds1 = ds.copy()
- steps.append(timer())
- ds.divide(ds1, out=ds)
- steps.append(timer())
- t1 = dt(steps)
- print("ds.divide(ds1, out=ds)", dt(steps))
- steps.append(timer())
- ds2 = ds.divide(ds1)
- steps.append(timer())
- t2 = dt(steps)
- print("ds2 = ds.divide(ds1)", dt(steps))
+ t1 = 0
+ t2 = 0
+ for i in range(10):
+ steps.append(timer())
+ ds.divide(ds1, out=ds)
+ steps.append(timer())
+ t1 += dt(steps)/10.
+ print("ds.divide(ds1, out=ds)", dt(steps))
+ steps.append(timer())
+ ds2 = ds.divide(ds1)
+ steps.append(timer())
+ t2 += dt(steps)/10.
+ print("ds2 = ds.divide(ds1)", dt(steps))
self.assertLess(t1, t2)
self.assertEqual(ds.as_array()[0][0][0], 1.)