Skip to content

Commit

Permalink
Adding compiler speed benchmarks (just to measure)
Browse files Browse the repository at this point in the history
  • Loading branch information
costrouc committed Apr 11, 2019
1 parent fb16ab7 commit 82f458e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions benchmarks/test_compiler.py
@@ -0,0 +1,26 @@
from moa.frontend import LazyArray


def test_moa_compile_simple(benchmark):
A = LazyArray(name='A', shape=('n', 'm'))
B = LazyArray(name='B', shape=('k', 'l'))

expression = A + B

def _test():
expression.compile(backend='python', use_numba=True)

benchmark(_test)


def test_moa_compile_complex(benchmark):
A = LazyArray(name='A', shape=('n', 'm'))
B = LazyArray(name='B', shape=('k', 'l'))
C = LazyArray(name='C', shape=(10, 5))

expression = (A.inner('+', '*', B)).T[0] + C.reduce('+')

def _test():
expression.compile(backend='python', use_numba=True)

benchmark(_test)

0 comments on commit 82f458e

Please sign in to comment.