Hello everyone,
When executing StatelessKnowledgeSession with command, if it's BatchExecutionCommand , it forces the ServiceLoader to load Command service.
Cannot it be instanciated once? Most time is spend on this operation
public <T> T execute(Command<T> command) {
StatefulKnowledgeSession ksession = newWorkingMemory();
RegistryContext context = RegistryContext.create().register( KieSession.class, ksession );
try {
if ( command instanceof BatchExecutionCommand ) {
context.register( ExecutionResults.class, KieServices.get().getCommands().newExecutionResults() );
}
You can see same rules flamegraphs , when I made static field and reused the KIE_COMMAND
Thanks