{'fraction_non_alphanumeric': 0.010676156583629894, 'fraction_numerical': 0.0, 'mean_word_length': 5.645669291338582, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Optimizing term rewriting using discrimination nets with specialization

TRAM is an abstract machine for order-sorted conditional term rewriting systems and its rewriting strategy is the E strategy. The straightforward implementation led to the similar performance of interpreters of lazy functional languages. In this paper, some optimization for term rewriting using discrimination nets is described, which can improve the performance of TRAM. The optimization specializes a pattern matcher wrt a discrimination net of rewrite rules and procedures that instantiate the right sides of rewrite rules wrt each of them. The preliminary experiment using rewrite rules to compute Fibonacci numbers showed the specialized implementation was five times faster than the straightforward one. The optimization can be applied to TRAM without difficulty.