stevespringett / cvss-calculator

A Java library for calculating CVSSv2 and CVSSv3 scores and vectors
Apache License 2.0
39 stars 23 forks source link

Improve Cvss.from() parsing performance #75

Closed anderruiz closed 1 year ago

anderruiz commented 1 year ago

What does it do?

Improve parsing performance by optimizing several parts:

The performance was measured with a JMH test that I did not push, but that I could if it can be interesting

Update

There is an improvement made on top of this PR here, that basically replace the usage of String (whenever possible) by chars which ends in a faster parsing and serialization (getVector). I also included additional test for the parsing part. I would vote for using the char based one, but we can split it in two different PRs if needed

anderruiz commented 1 year ago

@stevespringett any advance with this?

stevespringett commented 1 year ago

LGTM

stevespringett commented 1 year ago

Let me know if you'd like a release or if there's another performance optimization you'd like to include beforehand.

anderruiz commented 1 year ago

Let me know if you'd like a release or if there's another performance optimization you'd like to include beforehand.

I created a new PR, it would be great if we could merge it and release a version. I'm considering including support for CVSS 4.0 if you are fine with it.

stevespringett commented 1 year ago

Thanks for the optimizations @anderruiz Very much appreciated. v1.4.2 has been released to Maven Central and should be publicly available in the next 15 minutes or so. Support for CVSSv4 would be amazing.