Nicolas benchmarked his embedded OpenWFE and asked me to reduce the parsing time of process definitions, he had identified it as a major bottleneck. The initial releases of OpenWFE cached the process definitions, but that implementation was awkward and the caching came in the way of users in process design environments, they wanted their modified process definitions to be immediately available, other problems were also induced by this initial optimization.
Nicolas’ tests are against the latest releases of OpenWFE which do not contain any optimization on the process definition parsing front.
The solution was simply to cache any XML being loaded into OpenWFE from files (URLs) or strings. As soon as a request for something already parsed once arrives, the cache replies by cloning the corresponding JDOM XML tree. A short process definition could take 200ms to be turned into a JDOM document instance from its file, cloning the [whole] JDOM tree takes usually less than 1 ms.
Of course, if the file or the URL yields a newer version, it will be parsed (and then cached).
Nicolas’ benchmark times thus got cut in two.
When the initial optimization got removed, the remaining code was slower but could evolve with more freedom (a point for aspect-oriented programming).
The new optimization requested by Nicolas occurs in the OpenWFE library in charge of XML loading, whereas the initial one occured in the engine itself when loading new XML process definition. The engine’s code doesn’t include caching concerns (as before this new optimization).
This change is part of the upcoming OpenWFE 1.7.2 (since its pre4).
(Yes, I use JDOM and I’m happy with it).