Can you suggest a way to optimize this particular process flow to minimize execution overhead? I get the impression that custom plugins are interpretively executed, and it could be that a compiled java class might improve performance.
You can do that by creating a Custom Class and place that compiled Custom Class in "Custom Classes" folder. Then you can call that custom class in your Custom Plugin.
For integrating java classes with jars in Adeptia you need to place the jar in ext folder (“C:\ServerKernel\ext”). And for using the custom classes(testClass.class) in Adeptia you need to place these classes in the customClasses folder (“ServerKernel\customClasses”) and restart the Kernel and Web runner.
When you place these classes into customClasses folders then you will be able to call the methods of the class in the Custom Plugin by creating the object of that class.