Consider caching Spdx-Java-library state
pmonks opened this issue · comments
The Spdx-Java-Library is exceptionally expensive to initialise with the basic reference data (license and exception lists, templates etc.). On my laptop it generally takes more than a minute to pull this information down, parse it, and load it into memory.
There may be a way to cache the library's state to disk (e.g. via serialisation, perhaps using nippy
) and only incur the cost of initialisation when the lists have changes (which can be determined via an eTag request to the two list URLs).
A quick experiment with nippy
suggests this may not be easy solely from Clojure:
$ clj -Sdeps '{:deps {com.taoensso/nippy {:mvn/version "RELEASE"}}}' -r
user=> (require '[taoensso.nippy :as nippy])
nil
user=> (require '[spdx.licenses :as sl])
nil
user=> (sl/init!)
nil
user=> (require '[spdx.exceptions :as se])
nil
user=> (se/init!)
nil
user=> (require '[spdx.impl.state :as sis])
nil
user=> (nippy/freeze @sis/list-obj)
Execution error (ExceptionInfo) at taoensso.nippy/throw-unfreezable (nippy.clj:999).
Unfreezable type: class org.spdx.library.model.license.ListedLicenses
user=>
Raised spdx/Spdx-Java-Library#193 to see if this can be fixed in the underlying Java library (which is a better place for it anyway).
This is fixed in Spdx-Java-Library v1.1.8.