ParserBase could be optimized
@ezio-melotti がすでに取り組んでいます。
2022年5月1日 から。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- PR マージ指標
- PR 指標を取得中
説明
There is a lot of wasteful CPU code in this fashion (seen multiple times) :-
if ")" in rawdata[j:]:
j = rawdata.find(")", j) + 1
search performed in string twice, even if we could just do it once.
Consider the strings immutable, then on every slice a new string is created on the fly.
Moreover, the slicing done at rawdata[j:], is bound to be quite expensive depending on the size of the string.
We could eliminate slicing altogether and only have one find operation in this style :-
RPAREN_pos = rawdata.find(")", j)
if find_RPAREN != -1:
j = RPAREN_pos + 1
I'm new to Open Source Code Contributions. Would love to learn from other's coding style & know other's point of view.
Originally posted by @be-thomas in https://github.com/python/cpython/issues/92084#issuecomment-1114023102
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。