Skip to content

docs(readme): fix throughput example and entropy description - #89

Merged
framinosona merged 2 commits into
mainfrom
framinosona/docs-copilot-followups
Nov 23, 2026
Merged

framinosona merged 2 commits into
mainfrom
framinosona/docs-copilot-followups

Conversation

@framinosona

Copy link
Copy Markdown
Member

Summary

Follow-up to #88, from the review comments left on it. Two statements in the docs were wrong.

  • Throughput example: MeasurePerformance times all iterations (totalTime), while CalculateThroughput divides data.Length by the duration it is given, so the duration must be that of a single run. The README passed totalTime (1000 iterations), which understated throughput by a factor of 1000. It now passes averageTime. The same mistake was in the analysis-pipeline example in Docs/ByteArrayUtilities.md (100 iterations); fixed there too. Every other CalculateThroughput call in the docs and in .github/copilot-instructions.md already passes a single-run time.
  • Entropy description: CalculateEntropy is the Shannon entropy of the byte-value distribution. It counts occurrences and ignores order, so the sequence 0..255 and any permutation of it both give 8.0, and 0.0 means a single distinct value. The README comment described it as "ordered … random", and Docs/ReadOnlySpanUtilities.md said the same ("randomness", "perfectly ordered", and use cases such as testing random number generators). Both now describe the distribution, and the use cases no longer suggest a randomness test.

I checked the claims by running them in a scratch project: entropy of 0..255 and of a shuffled copy is 8, of {5,5,5,5} is 0; with 200 iterations the throughput computed from totalTime is 1/200 of the one computed from averageTime, and the latter matches an independent single-run measurement. The README and Docs/index.md C# snippets still compile against the library.

Why

A reader copying the README example got a throughput figure that was off by the iteration count, and the entropy wording promised more than the function measures.

Not changed here: the XML doc comments on CalculateEntropy in ReadOnlySpanUtilities.cs and ByteArrayUtilities.cs use similar "randomness" wording. They are source comments, so I left them for a separate change.

Change Type

  • Feature
  • Bug fix
  • Refactor
  • Docs only
  • CI/build/tooling

Affected Areas

  • ByteArrayExtensions
  • ReadOnlySpanExtensions / ReadOnlyMemoryExtensions
  • ByteArrayBuilder
  • Tests
  • Docs

Behavior And Compatibility

  • Public API changed
  • Exception behavior changed
  • No externally visible behavior change

Tests

  • Unit tests added/updated
  • Not applicable (docs only; the claims were verified in a scratch project, see Summary)

Documentation

  • README feature table updated
  • XML docs added/updated
  • Not applicable (no public API change)

Checklist

  • Commit messages follow Conventional Commits (type(scope): subject)
  • CI passes
  • Change is scoped to one logical unit of work

CalculateThroughput divides the array length by the duration it is given, so the MeasurePerformance examples must pass averageTime, not totalTime. CalculateEntropy measures the byte-value distribution and ignores order; describe it that way.
Copilot AI balanced review requested due to automatic review settings November 23, 2026 01:04
The XML docs called entropy a measure of randomness and 0.0 'perfectly ordered'. CalculateEntropy only counts how often each byte value occurs and ignores their order. Comment-only change.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the documentation-only corrections to throughput examples and entropy explanations.

No open issues 🎉

What changed in this PR

This documentation-only follow-up to #88 corrects throughput examples and clarifies what byte-distribution entropy measures. No library behavior or public APIs change.

Changes:

  • Use average iteration time rather than total elapsed time when calculating throughput.
  • Describe entropy in terms of byte-value frequencies, independent of byte order.
  • Revise entropy use cases to avoid presenting it as a randomness test.
File Description
README.md Corrects the throughput example and entropy explanation.
Plugin.ByteArrays.Docs/​ReadOnlySpanUtilities.md Clarifies entropy’s meaning, range, and use cases.
Plugin.ByteArrays.Docs/​ByteArrayUtilities.md Clarifies entropy and fixes throughput timing in the analysis example.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 23, 2026 01:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the documentation updates to throughput examples and byte-value entropy guidance.

No open issues 🎉

Review effort: Balanced

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: C#

C# / code-coverage/coverlet

main cf31f5c framinosona/docs-cop... a8bb823 +/-
92% 92% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@github-actions

Copy link
Copy Markdown

Test Results

683 tests  ±0   683 ✅ ±0   1s ⏱️ ±0s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit a8bb823. ± Comparison against base commit cf31f5c.

@framinosona
framinosona merged commit 721de3b into main Nov 23, 2026
14 checks passed
@framinosona
framinosona deleted the framinosona/docs-copilot-followups branch November 23, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants