Potential optimisation for LicenseCompareHelper.matchingStandardLicenseIdsWithinText()
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 28/100
- Issue-Typ
- Refactoring
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- java
- Bereich
- performance
Rechercherichtung
Beginne in src/main/java/org/spdx/utility/compare/LicenseCompareHelper.java, insbesondere bei matchingStandardLicenseIdsWithinText() und den zugehörigen Methoden. Prüfe zunächst, ob Matches Indizes des Originaltexts offenlegen und wie sich überlappende Templates wie GPL-2.0-only und GPL-2.0-or-later verhalten. Als abgeschlossen gilt die Arbeit, wenn eine definierte Strategie für Matching-Reihenfolge und Textentfernung vorliegt, die erforderliche Ergebnisse und das Indexverhalten bewahrt und gleichzeitig eine Leistungsverbesserung nachweist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
It occurred to me that there may be a potentially substantial performance optimisation possible within the org.spdx.utility.compare.LicenseCompareHelper.matchingStandardLicenseIdsWithinText() family of methods, beyond the existing "quick check regex" optimisation.
Specifically, the idea is that when a match is found for a given license within an input text, the subset of text that matched is removed from the input text before further matching is performed. This not only speeds up subsequent matching (by reducing the size of the input), it also allows for early termination once the input is exhausted (i.e. below the size of the smallest possible match).
This enhancement could (should?) also order matching by approximate license popularity (i.e. the most popular licenses are checked first), since that would tend to result in early termination being reached more frequently in real world use. The OSI publishes such a list, albeit only for OSI-approved licenses - I'm fairly certain I've seen other sources of license popularity that would be more than enough for this purpose (after all it doesn't have to be precise - even using an approximate popularity order would be a lot better than random, or alphabetical, matching processing).
One possible complication is when two templates match the same text - for example the GPL-2.0-only and GPL-2.0-or-later templates tend to match the same thing. If this optimisation were implemented as I'm envisaging, whichever license template is used first would be the only one to show up in the result. Though if that behaviour is undesirable there may be workarounds - the library might maintain a list of "overlapping" templates, and ensure that when one of them matches a given text, the other overlapping templates are always checked too, prior to the matched text being removed from the input.
Another possible complication is if LicenseCompareHelper provides indexes into the original input text where a match was found (I don't recall if it does this or not; if it does I'm not currently using that capability). If so, there will be some extra bookkeeping needed to make sure that those indexes remain correct, given that each subsequent match attempt might only be looking at a fragmented subset of the original input.
- Vorherrschende Sprache
- Java
- Sterne
- 71
- Forks
- 44
- Ø Merge
- 16 Std. 22 Min.
- Gemergte PRs (30 T.)
- 9
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus spdx/Spdx-Java-Library
-
question
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
spdx/Spdx-Java-Library#449 ·
-
question
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
spdx/Spdx-Java-Library#398 ·
-
wontfix
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
spdx/Spdx-Java-Library#393 · 2 Kommentare · 1 Reaktion ·
-
matching
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
spdx/Spdx-Java-Library#392 · 4 Kommentare ·
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
spdx/Spdx-Java-Library#390 · 11 Kommentare · 1 Reaktion ·
Alle Issues in spdx/Spdx-Java-Library
Ähnliche Issues
-
:maddi-inspection-kotlin:test runs out of heap in a full maddi test run; exit 1 with no failing testOffenbuild/ci front-end:kotlin
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
uwolfer/gerrit-intellij-plugin#768 ·
Maintainer antworten meist innerhalb von 1 Tag
-
github_actions
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
hiero-ledger/hiero-consensus-node#27621 ·
Maintainer antworten meist innerhalb von 1 Tag
-
x:knowledge/elementary x:module/practice-exercise
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100