Skip to content

Comments

Feature/alignment cleanup#30

Open
Malkovsky wants to merge 10 commits intomainfrom
feature/alignment_cleanup
Open

Feature/alignment cleanup#30
Malkovsky wants to merge 10 commits intomainfrom
feature/alignment_cleanup

Conversation

@Malkovsky
Copy link
Owner

No description provided.

@kiloconnect
Copy link

kiloconnect bot commented Feb 15, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
src/benchmarks/benchmarks.cpp 105 Cache the 64-bit span once to avoid redundant As64BitInts() calls in benchmark setup.
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
Files Reviewed (3 files)
  • .github/workflows/benchmarks-test.yml - 0 issues
  • src/benchmarks/benchmarks.cpp - 1 issue
  • src/docs/Doxyfile.in - 0 issues

Fix these issues in Kilo Cloud

* @brief Mutable view as bytes.
* @note Uses a byte pointer to the underlying storage.
*/
std::span<std::uint16_t> As16BitInts() {
Copy link

Choose a reason for hiding this comment

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

WARNING: Missing <cstdint> include for std::uint16_t

As16BitInts() and AsConst16BitInts() use std::uint16_t but the header doesn't include <cstdint>, which can break builds depending on transitive includes.


std::mt19937_64 rng(42);
for (auto _ : state) {
uint64_t pos = rng() % n;
Copy link

Choose a reason for hiding this comment

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

SUGGESTION: Avoid modulo when n is a power of two in this hot loop

For power-of-two sizes, using pos = rng() & (n - 1) can be measurably faster than % n. You already apply this optimization in BM_RankNonInterleaved12p5PercentFill, and reusing it here would keep benchmark overhead consistent with the other paths.

pixie::BitVector bv(bits, n);
AlignedStorage bits(n);
PrepareRandomBits50pFill(bits.As64BitInts());
pixie::BitVector bv(bits.As64BitInts(), n);
Copy link

Choose a reason for hiding this comment

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

SUGGESTION: Cache the 64-bit span once for this benchmark

You call As64BitInts() twice for the same AlignedStorage. Storing it in a local auto bits_as_words = bits.As64BitInts(); avoids redundant span construction and size computation in hot benchmark setup code.

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.

1 participant