The SciJava Context and Services have been diligent about lazy initialization to optimize startup speeds. However, this can delay performance hits, leading to perceivable performance drops the first time various functions are invoked.
Thus we should provide a Context.preload method that performs an initialize-style function across all Services. This allows it to be opt-in both at the Service implementation level, and Context consumption level (e.g. developers could choose to make a Context and not call preload).
The actual preload implementations should perform necessary construction and caching on a dedicated thread to mitigate visible performance problems for users.
The SciJava
ContextandServiceshave been diligent about lazy initialization to optimize startup speeds. However, this can delay performance hits, leading to perceivable performance drops the first time various functions are invoked.Thus we should provide a
Context.preloadmethod that performs aninitialize-style function across allServices. This allows it to be opt-in both at theServiceimplementation level, andContextconsumption level (e.g. developers could choose to make aContextand not callpreload).The actual
preloadimplementations should perform necessary construction and caching on a dedicated thread to mitigate visible performance problems for users.