Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider caching Spdx-Java-library state #22

Closed
pmonks opened this issue Sep 3, 2023 · 3 comments
Closed

Consider caching Spdx-Java-library state #22

pmonks opened this issue Sep 3, 2023 · 3 comments
Labels
blocked Blocked on an external issue. enhancement New feature or request

Comments

@pmonks
Copy link
Owner

pmonks commented Sep 3, 2023

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).

@pmonks pmonks added the enhancement New feature or request label Sep 3, 2023
@pmonks
Copy link
Owner Author

pmonks commented Sep 3, 2023

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=> 

@pmonks
Copy link
Owner Author

pmonks commented Sep 3, 2023

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).

@pmonks pmonks added the blocked Blocked on an external issue. label Sep 3, 2023
@pmonks
Copy link
Owner Author

pmonks commented Oct 7, 2023

This is fixed in Spdx-Java-Library v1.1.8.

@pmonks pmonks closed this as completed Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked on an external issue. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant