Hi Christian,
In this case, BaseX is embedded in a Java application (Eclipse RCP) and provides "live editing" of parts of big XML files (managed by BaseX). Just imagine we have an O(n^2) algorithm which visits 100x100 "data items" while executing 10 different (and "simple") expressions (in the inner loop). That would be 100x100x10 = 100'000 parsing/compiling operations taking in sum 5000 ms if 1 parsing/compiling operation takes 0.05 ms. If the expressions would be cacheable, then, maybe it would just take 10 x (0.05 ms + (lookup of compiled expression))
Of course, O(n^2) is bad, but that is another story.
The idea is to be able to cache compiled expressions (like parsing/compiling regex in java).
Thanks!