Improves application startup time
The CheerpJ runtime is highly optimised to minimise the total download size of an ‘average’ application, totalling 10-20MB of data for a typical download (as a point of comparison, the approximate size of the Java runtime installer is over 60MB). All downloaded components of CheerpJ are cached by the browser, which reduces the download time in subsequent executions of a same application.
CheerpJ cannot predict which runtime resources will be required by an arbitrary application. CheerpJ runtime resources are therefore loaded on demand, one after the other, depending on the requirements of the application at run time.
To take advantage of parallel downloads, and reduce download and startup time of a specific application in production, CheerpJ allows to pre-specify a list of resources (CheerpJ runtime modules) to be loaded at startup.
This list of resources is to be specified manually when starting the CheerpJ environment in an HTML page. We also provide a simple profiling tool to automatically record and output a list of used resources during the execution of an application.
By combining the use of this profiler together with the preloader, one can highly optimise the initial download and startup time of an application. Taking advantage of this is a simple 2-step process:
The result will look like this:
If the output is not visible fully, you can use:
"), which you should ignore. See here for more information.
- Modify the CheerpJ integration to enable preloading. You will only need to change the
cheerpjInitcall, to pass the
preloadResourcesoption. For example:
ImportantPlease note that this has to be done in two steps, so the resources are loaded in a separate session from the full workflow.
See here for more information.
When preloading is enabled CheerpJ will be able to download multiple resources in parallel with the execution of the program. This will greatly improve loading time.