HistogramBase.GetValueAtPercentile — Double-Loop When Flat Array Index Is Available
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 55/100
- issue の種類
- リファクタリング
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- csharp
- 領域
- performance
調査の方向性
Start in HistogramBase.cs at GetValueAtPercentile and inspect how LongHistogram stores its counts, including CountsArrayLength, GetCountAtIndex, and ValueFromIndex. Compare the existing nested scan with the proposed flat traversal; done means percentile lookup preserves the current result while avoiding the nested index mapping.
索引モデルが issue の本文から書いたものです。
説明
File: HistogramBase.cs
The percentile lookup iterates nested i / j loops over BucketCount × SubBucketCount. Since CountsArrayIndex(bucketIndex, subBucketIndex) maps this to a flat array, and the counts array is already flat in LongHistogram, the entire scan can be done as a single flat loop:
public long GetValueAtPercentile(double percentile) { var countAtPercentile = Math.Max( (long)((Math.Min(percentile, 100.0) / 100.0 * TotalCount) + 0.5), 1);long runningCount = 0; for (int i = 0; i < CountsArrayLength; i++) { runningCount += GetCountAtIndex(i); if (runningCount >= countAtPercentile) return HighestEquivalentValue(ValueFromIndex(i)); } throw new ArgumentOutOfRangeException(...);
}
The nested loop computes GetCountAt(i, j) → GetCountAtIndex(CountsArrayIndex(i, j)) anyway — the flat version eliminates the CountsArrayIndex call per iteration and improves cache locality by accessing memory sequentially.
- 主要言語
- C#
- スター
- 185
- フォーク
- 31
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
HdrHistogram/HdrHistogram.NET のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
HdrHistogram/HdrHistogram.NET#167 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
HdrHistogram/HdrHistogram.NET#166 ·
-
WriterReaderPhaser.FlipPhase - Task.Yield().GetAwaiter().GetResult() is a Thread Pool Anti-Pattern オープンagent enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
HdrHistogram/HdrHistogram.NET#144 ·
-
agent enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
HdrHistogram/HdrHistogram.NET#142 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
HdrHistogram/HdrHistogram.NET#156 ·
HdrHistogram/HdrHistogram.NET の issue をすべて見る
似ている issue
-
untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
dotnet/dotnet-api-docs#13095 ·
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100
-
type/automation type/tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
newrelic/newrelic-dotnet-agent#3850 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
LuckyPennySoftware/AutoMapper#4660 ·