Skip to content

benchmark string fix to save RAM - #514

Merged
AlexLanzano merged 2 commits into
wolfSSL:mainfrom
bigbrett:bench-string-size-reduction
Aug 20, 2026
Merged

benchmark string fix to save RAM#514
AlexLanzano merged 2 commits into
wolfSSL:mainfrom
bigbrett:bench-string-size-reduction

Conversation

@bigbrett

@bigbrett bigbrett commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

This PR reduces RAM usage in the benchmark timing subsystem by changing benchmark operation names from an inline fixed-size buffer to a referenced string pointer.

Changes:

Replace whBenchOp.name fixed-size char[] storage with a const char* stored by reference.
Update wh_Bench_RegisterOp to compare names with strcmp and store the pointer directly.
Update header comments to document the new name lifetime requirement.

@bigbrett bigbrett self-assigned this Aug 19, 2026
Copilot AI lite review requested due to automatic review settings August 19, 2026 19:43

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.

Pull request overview

This PR reduces RAM usage in the benchmark timing subsystem by changing benchmark operation names from an inline fixed-size buffer to a referenced string pointer.

Changes:

  • Replace whBenchOp.name fixed-size char[] storage with a const char* stored by reference.
  • Update wh_Bench_RegisterOp to compare names with strcmp and store the pointer directly.
  • Update header comments to document the new name lifetime requirement.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
benchmark/wh_bench_ops.h Changes operation name storage to const char* and updates API documentation for the new lifetime semantics.
benchmark/wh_bench_ops.c Updates registration logic to use strcmp and store the operation name by reference.
Suppressed comments (1)

benchmark/wh_bench_ops.h:89

  • Since wh_Bench_RegisterOp now stores name by reference, it would help to explicitly state in the API comment that name must be a NUL-terminated C string and is not copied (caller must keep it alive until cleanup).
/* Register a new benchmark operation with a name, returns ID via pointer.
 * The name is stored by reference and must stay valid until
 * wh_Bench_Cleanup */

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread benchmark/wh_bench_ops.h
@bigbrett
bigbrett marked this pull request as ready for review August 19, 2026 19:56

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #514

Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread benchmark/wh_bench_ops.c
@bigbrett bigbrett assigned AlexLanzano and unassigned bigbrett Aug 20, 2026
@AlexLanzano
AlexLanzano merged commit 3fe7250 into wolfSSL:main Aug 20, 2026
26 checks passed
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.

4 participants