Skip to content

Commit

Permalink
Use mapper optimizer in traversal benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Oct 1, 2022
1 parent 2da9719 commit 79f21b0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions experiments/traversal-benchmark.py
@@ -1,8 +1,11 @@
# See https://github.com/inducer/pymbolic/pull/110 for context

import sys

from pymbolic import parse
from pymbolic.primitives import Variable
from pymbolic.mapper import CachedIdentityMapper
from pymbolic.mapper.optimize import optimize_mapper


code = ("(-1)*((cse_577[_pt_data_48[((iface_ensm15*1075540 + iel_ensm15*10 + idof_ensm15) % 4302160) // 10, 0],"
Expand Down Expand Up @@ -94,6 +97,10 @@
}


@optimize_mapper(drop_args=True, drop_kwargs=True,
# inline_cache=True, inline_rec=True,
inline_get_cache_key=True,
print_modified_code_file=sys.stdout)
class Renamer(CachedIdentityMapper):
def map_variable(self, expr):
return replacements.get(expr.name, expr)
Expand Down

0 comments on commit 79f21b0

Please sign in to comment.