Potential optimisation for LicenseCompareHelper.matchingStandardLicenseIdsWithinText()
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 28/100
- Tipo di issue
- Refactoring
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- java
- Ambito
- performance
Direzione di ricerca
Inizia da src/main/java/org/spdx/utility/compare/LicenseCompareHelper.java, in particolare da matchingStandardLicenseIdsWithinText() e dai relativi metodi. Verifica innanzitutto se le corrispondenze espongono gli indici del testo originale e come vengono gestiti i template sovrapposti, come GPL-2.0-only e GPL-2.0-or-later. Il lavoro è completato quando è definita una strategia per l’ordine di matching e la rimozione del testo che preservi i risultati richiesti e il comportamento degli indici, dimostrando al contempo un miglioramento delle prestazioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Java
- Stelle
- 71
- Fork
- 44
- Merge medio
- 16h 17m
- PR unite (30g)
- 9
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di spdx/Spdx-Java-Library
-
question
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
spdx/Spdx-Java-Library#449 ·
-
question
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
spdx/Spdx-Java-Library#398 ·
-
wontfix
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
spdx/Spdx-Java-Library#393 · 2 commenti · 1 reazione ·
-
matching
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
spdx/Spdx-Java-Library#392 · 4 commenti ·
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
spdx/Spdx-Java-Library#390 · 11 commenti · 1 reazione ·
Tutte le issue di spdx/Spdx-Java-Library
Issue simili
-
[Bug] Logo style setting missing and `classic` style not applied across multiple platforms (v3.1.0)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Stirling-Tools/Stirling-PDF#8382 · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
I maintainer di solito rispondono entro 4 giorni
-
enhancement untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
opensearch-project/sql#5842 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
openhab/openhab-addons#21882 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
YunaiV/ruoyi-vue-pro#1273 ·
I maintainer di solito rispondono entro 3 giorni