Do we still need `asciilib` for better performance?

オープン
#98,229 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
c, python
領域
performance

調査の方向性

unicode_countで使用されるasciilib_count呼び出しと、asciilib_rsplit_whitespaceのパスから始め、Windows、macOS、LinuxでASCII入力と非ASCII入力を比較します。短い文字列と長い文字列を使って、影響を受けるPythonメソッドとC API関数を測定します。完了の条件は、呼び出しを残すべきか削除すべきかを判断できる十分なベンチマーク結果を得ることです。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
77.2k
フォーク
36k
平均マージ
1日 9時間
マージ済み PR(30日)
558

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python/cpython のほかの issue

python/cpython の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。