Potential optimisation for LicenseCompareHelper.matchingStandardLicenseIdsWithinText()
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 28/100
- Type d'issue
- Refactorisation
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- java
- Domaine
- performance
Piste de recherche
Commencez dans src/main/java/org/spdx/utility/compare/LicenseCompareHelper.java, en particulier dans matchingStandardLicenseIdsWithinText() et ses méthodes associées. Vérifiez d’abord si les correspondances exposent les index du texte d’origine et comment sont gérés les templates qui se chevauchent, tels que GPL-2.0-only et GPL-2.0-or-later. Le travail sera considéré comme terminé lorsqu’une stratégie définie d’ordre de correspondance et de suppression du texte préservera les résultats requis et le comportement des index, tout en démontrant une amélioration des performances.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Java
- Étoiles
- 71
- Forks
- 44
- Merge moyen
- 16 h 17 min
- PR mergées (30 j)
- 9
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de spdx/Spdx-Java-Library
-
question
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
spdx/Spdx-Java-Library#449 ·
-
question
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
spdx/Spdx-Java-Library#398 ·
-
wontfix
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
spdx/Spdx-Java-Library#393 · 2 commentaires · 1 réaction ·
-
matching
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
spdx/Spdx-Java-Library#392 · 4 commentaires ·
-
enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
spdx/Spdx-Java-Library#390 · 11 commentaires · 1 réaction ·
Toutes les issues de spdx/Spdx-Java-Library
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
portfolio-performance/portfolio#6119 ·
Les mainteneurs répondent en général sous 8 jours
-
Bump up AWS SDK to 2.54.3Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
jenkinsci/ec2-plugin#2041 ·
-
L: github:actions L: php:composer
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
dependabot/dependabot-core#16493 ·
Les mainteneurs répondent en général sous 1 jour
-
SHOW EDIT of a subclass for an object of its superclass: the form fails to open with AssertionErrorOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100