From 54c4c91097c50f6cedb02cb5b1aea32ae16a3421 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Sat, 14 Oct 2023 14:54:38 +0200 Subject: refactor(interpreter-rete): recipe hashing Use isomorphism-aware hashing to speed up RecipeRecognizer. Due to possibly cyclic (recursive) recipes, we can't recursively turn recipes into a canonical form. Recipes referring to already canonical (non-recurisve, or recursive and entirely canonicalized) recipes can be hashed, while recursive recipes in the middle of caninicalization still have to be compared more slowly by their contents. To keep the list of recipes compared by contents small, recipes are assigned a hash code whenever possible. We keep the equivalence class IDs for recipes, as there might be hash code clashes, as well as recursive recipes that only later get assigned a hash code. Also fixes a concurrency problem with equivalence class IDs by using an AtomicLong. Also reworks recipe instantiation, as now recipes might be canonicalized before they are instantiated. --- .../src/main/resources/model/recipes.ecore | 2 ++ .../src/main/resources/model/rete-recipes.genmodel | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'subprojects/interpreter-rete-recipes/src/main/resources/model') diff --git a/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore index a4617833..6b8f10ea 100644 --- a/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore +++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore @@ -31,6 +31,8 @@
+ + diff --git a/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel b/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel index 89ff6e3a..f7dc7a4e 100644 --- a/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel +++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel @@ -2,10 +2,11 @@ + modelPluginID="tools.refinery.refinery-interpreter-rete-recipes" runtimeJar="true" + forceOverwrite="true" modelName="Rete-recipes" updateClasspath="false" nonNLSMarkers="true" + rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" testsDirectory="" + importerID="org.eclipse.emf.importer.ecore" containmentProxies="true" complianceLevel="7.0" + language="en" operationReflection="true">
@@ -32,6 +33,8 @@ + + -- cgit v1.2.3-54-g00ecf