Re-benchmark num_digits_fast against num_digits_faster after the boundary fix
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- ドキュメント
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- performance
調査の方向性
maths/number_of_digits.pyを読み、3つの実装を比較してください。その後、PR #15761がマージされたらbenchmark()を実行してください。結果を記録し、測定結果に合わせてdocstringまたは関数名を更新してください。整数から文字列への変換で文書化されている桁数制限も含めます。ベンチマークと説明が、測定されたトレードオフを反映したら完了です。
索引モデルが issue の本文から書いたものです。
説明
Feature description
Feature description
PR #15761 (fixing #15754) makes num_digits_fast in maths/number_of_digits.py exact by adding a correction step after math.log10. The correction computes 10 ** (digits - 1) and 10**digits, which are big-integer powers and add cost for large inputs.
In a quick local timing on 2**100 (200,000 calls with timeit), the corrected approach took about 0.148 s, versus about 0.035 s for len(str(abs(n))). So the function named "fast" may no longer be the fastest of the three.
Proposed follow-up, once #15761 is merged:
- Re-run
benchmark()in the file and record the results for all three functions. - If
num_digits_fastis no longer faster, update its docstring to say it is a log10-based approach, or rename or reorder the functions so the names match the results. - Add a note on the int-to-string length limit:
len(str(n))raises ValueError for ints above about 4300 digits by default in Python 3.11+, while the log10 approach avoids it. That is a reason to keep it.
I'm happy to open a PR for the docstring and benchmark update after #15761 lands.
- 主要言語
- Python
- スター
- 226k
- フォーク
- 51.3k
- 平均マージ
- 8時間 58分
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TheAlgorithms/Python のほかの issue
-
binomial_distribution overflows at 171 trials even when the result is representable対応中かも @landfvit が 19 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
TheAlgorithms/Python#15656 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
continued_fraction uses float division, producing invalid terms for large integers and raising OverflowError対応中かも @trleo が 19 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
TheAlgorithms/Python#15655 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
ciphers/base32.py and ciphers/base85.py encode Unicode code points instead of bytes: output diverges from the spec for non-ASCII, round-trips corrupt chars >= U+0400, arbitrary bytes crash対応中かも @Nate-br が 21 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
TheAlgorithms/Python#15636 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
ciphers/des_ecb.py: encrypt/decrypt silently corrupts any character above U+00FF (round-trip fails)対応中かも @mohammedanasnakhuda が 21 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
TheAlgorithms/Python#15634 ·
メンテナーはふだん 1 日以内に返信
-
other/password.py: alternative_password_generator ignores the requested length when the required characters exceed it対応中かも @raaj-2222 が 22 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
TheAlgorithms/Python#15633 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
TheAlgorithms/Python の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
521xueweihan/HelloGitHub#4385 ·
-
🐛 bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
pdm-project/pdm#4012 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
pollen-robotics/reachy_mini_conversation_app#611 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 91/100
aws-samples/sample-per-model-bedrock#913 ·
メンテナーはふだん 1 日以内に返信
-
lesson-submission pending-review
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
Ikalus1988/MisakaNet#5115 ·
メンテナーはふだん 1 日以内に返信