ngsankha / absynthe

synthesis guided by abstract interpretation
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Reuse old subterms #2

Open ngsankha opened 2 years ago

ngsankha commented 2 years ago

Many programs have the form: (str.substr name (+ (str.indexof name "-" 0) 1) (+ (str.indexof name "-" 0) 4)) where (str.indexof name "-" 0) is repeated. Absynthe spends a lot of time duplicating the work to synthesize such repeated subterms. We just need to cache any concrete subterms that are synthesized and reuse them directly. Special care needs to be taken such that a cached subterm can only refer to synthesized terms before it (to avoid expressions becoming a cycle).

This has been done before:

I suspect implementing this will give good performance boosts, but from the point of view of research there is no new contribution here.

ngsankha commented 2 years ago

Partially done with the Cache class. There is no good heuristic to cache expressions now, so we cache on select few. Keeping this open.