Do we still need `asciilib` for better performance?

Offen
#98,229 7 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Refactoring
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
c, python
Bereich
performance

Rechercherichtung

Beginne mit den von unicode_count verwendeten asciilib_count-Aufrufen und dem Pfad asciilib_rsplit_whitespace und vergleiche ASCII- und Nicht-ASCII-Eingaben unter Windows, macOS und Linux. Miss die betroffenen Python-Methoden und C-API-Funktionen mit kurzen und langen Zeichenfolgen; abgeschlossen ist die Aufgabe, wenn genügend Benchmark-Evidenz vorliegt, um zu entscheiden, ob die Aufrufe beibehalten oder entfernt werden sollen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

interpreter-core performance type-feature

Feature or enhancement

asciilib was introduced in https://github.com/python/cpython/commit/c3cec7868bf1019c0987f1e9aadb56d73fa93d61 as a performance feature for ascii strings.

11 years have passed since then.

While working on https://github.com/python/cpython/pull/98025 we with @vstinner experimented on unicode_count with and without asciilib_count calls.

Results were clear: it does not bring any benefits on our benchmarks.
And this commit was made: https://github.com/python/cpython/commit/df3a6d9beb8a7a3fe87a6d4126384fd3e0213853

Later, while working on https://github.com/python/cpython/pull/98228 I've noticed that asciilib_rsplit_whitespace also does not provide significant performance gains on my platform and my simple data input.

So, maybe this should be analyzed deeply?

Pitch

  • I think that these calls should be further investigated: do we really need this?
  • We should come up with better data to make a final decision, including:
    • What pytohn methods / c-api functions are affected?
    • Short and long ascii / non-ascii strings (because this check slows down all non-ascii strings by calling extra PyUnicode_IS_ASCII(str)
    • Windows / MacOS / Linux platforms, maybe the results will be different

I don't have access to Windows, but I can do the research for other platforms.

If it does not provide any performance benefits, it should be removed.

Vorherrschende Sprache
Python
Sterne
77.2k
Forks
36k
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
558

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus python/cpython

Alle Issues in python/cpython

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.