Improved query

This commit is contained in:
2022-09-15 17:00:22 +02:00
parent ae3192b63c
commit 47ed0a705d
4 changed files with 13 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ import unittest
from cpl_query.enumerable import Enumerable
from cpl_query.iterable import Iterable
VALUES = 1000
VALUES = 10000
COUNT = 50
@@ -23,6 +23,7 @@ class PerformanceTestCase(unittest.TestCase):
enumerable = timeit.timeit(lambda: Enumerable(int, self.values), number=COUNT)
iterable = timeit.timeit(lambda: Iterable(int, self.values), number=COUNT)
print('Range')
print(f'd: {default}')
print(f'i: {iterable}')
print(f'e: {enumerable}')
@@ -35,6 +36,7 @@ class PerformanceTestCase(unittest.TestCase):
iterable = timeit.timeit(lambda: Iterable(int, self.values).where(lambda x: x == 50).single(), number=COUNT)
enumerable = timeit.timeit(lambda: Enumerable(int, self.values).where(lambda x: x == 50).single(), number=COUNT)
print('Where single')
print(f'd: {default}')
print(f'i: {iterable}')
print(f'e: {enumerable}')