tools-python icon indicating copy to clipboard operation
tools-python copied to clipboard

Fix several accidentally quadratic functions

Open jonjohnsonjr opened this issue 1 year ago • 5 comments

Fixes https://github.com/spdx/tools-python/issues/790

I am by no means a python expert, please let me know if there are more idiomatic ways to solve this.

After this change:

$ time pyspdxtools -i sbom.spdx.json
pyspdxtools -i sbom.spdx.json  1.57s user 0.06s system 95% cpu 1.708 total

Note that this document previously took almost 9 minutes to validate, so this is ~300x faster for that particular document.

jonjohnsonjr avatar Jan 29 '24 20:01 jonjohnsonjr

cc @meretp

This patch grew out of the use of ntia-conformance-checker. Thanks, @meretp, for helping with the transition to the new tools-python version for ntia-conformance-checker a few months back.

jspeed-meyers avatar Jan 30 '24 21:01 jspeed-meyers

I've update the PR with changes from @paulgibert that seem better than what I came up with :)

jonjohnsonjr avatar Feb 14 '24 18:02 jonjohnsonjr

@maxhbr or @meretp -- Any thoughts on this other approach?

jspeed-meyers avatar Feb 14 '24 22:02 jspeed-meyers

Hey, maybe it would be worth to connect in a video call?

maxhbr avatar Feb 15 '24 17:02 maxhbr

How would you feel about something like this instead? https://github.com/spdx/tools-python/pull/800

I suspect just changing those function signatures is probably not what we want to do (I assume it's a breaking change), but what if we kept the same signatures and introduced a parallel set of functions that takes a set instead of a list (list variant can just call set variant).

jonjohnsonjr avatar Feb 22 '24 17:02 jonjohnsonjr