I've tried to mark the W (Basic Annotation) with and without block logic. Outputs were same. But without BLOCK logic take less time compared to with BLOCK logic. Could any one explain in detail why there is a time difference? Thanks in advance. Code and Debugged (Applied rules) image attached.
An initial note: The profiling information displayed in the Ruta Workbench are only indicators, which rules consume how much processing time, and no exact measurement of the runtime performance due to missing warm up, debug info overhead and so on.
The short answer to your question is that the block rule consists of three separate rules with additional logic to restrict the matching window for the two inlined rules. Additionally, there is also a debug overhead for the additional logic.
As you see in my screenshot, Java optimizes already, and the actual number are hardly comparable. The third rule contains three matching rules on W, which takes approx. 3-4 times compared to the first rules. The fourth rule uses a local variable in order to avoid the redundant matches, which increases the runtime. The last BLOCK is even faster, but I would account that to Java optimizations.