Skip to content

[Base] using std::string_view rather than std::string in print#1748

Merged
tdavidcl merged 4 commits intoShamrock-code:mainfrom
tdavidcl:patch-2026-04-13-17-16
Apr 13, 2026
Merged

[Base] using std::string_view rather than std::string in print#1748
tdavidcl merged 4 commits intoShamrock-code:mainfrom
tdavidcl:patch-2026-04-13-17-16

Conversation

@tdavidcl
Copy link
Copy Markdown
Member

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

Thanks @tdavidcl for opening this PR!

You can do multiple things directly here:
1 - Comment pre-commit.ci run to run pre-commit checks.
2 - Comment pre-commit.ci autofix to apply fixes.
3 - Add label autofix.ci to fix authorship & pre-commit for every commit made.
4 - Add label light-ci to only trigger a reduced & faster version of the CI (need the full one before merge).
5 - Add label trigger-ci to create an empty commit to trigger the CI.

Once the workflow completes a message will appear displaying informations related to the run.

Also the PR gets automatically reviewed by gemini, you can:
1 - Comment /gemini review to trigger a review
2 - Comment /gemini summary for a summary
3 - Tag it using @gemini-code-assist either in the PR or in review comments on files

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the printing utility functions to use std::string_view instead of std::string, which helps reduce unnecessary string allocations and improves performance. These changes are applied to the print, println, and change_printer functions across the core library and its Python bindings. The review feedback suggests marking the internal function pointers in src/shambase/src/print.cpp as static to ensure internal linkage and prevent potential symbol collisions.

tdavidcl and others added 2 commits April 13, 2026 19:44
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Workflow report

workflow report corresponding to commit 012397d
Commiter email is 41898282+github-actions[bot]@users.noreply.github.com
You are using github private e-mail. This prevent proper tracing of who contributed what, please disable it (see Keep my email addresses private).
GitHub page artifact URL GitHub page artifact link (can expire)

Pre-commit check report

Pre-commit check: ✅

trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check for merge conflicts................................................Passed
check that executables have shebangs.....................................Passed
check that scripts with shebangs are executable..........................Passed
check for added large files..............................................Passed
check for case conflicts.................................................Passed
check for broken symlinks................................................Passed
check yaml...............................................................Passed
detect private key.......................................................Passed
No-tabs checker..........................................................Passed
Tabs remover.............................................................Passed
Validate GitHub Workflows................................................Passed
clang-format.............................................................Passed
ruff check...............................................................Passed
ruff format..............................................................Passed
Check doxygen headers....................................................Passed
Check license headers....................................................Passed
Check #pragma once.......................................................Passed
Check SYCL #include......................................................Passed
No ssh in git submodules remote..........................................Passed
No UTF-8 in files (except for authors)...................................Passed

Test pipeline can run.

Clang-tidy diff report

No relevant changes found.
Well done!

You should now go back to your normal life and enjoy a hopefully sunny day while waiting for the review.

Doxygen diff with main

Removed warnings : 3
New warnings : 13
Warnings count : 8443 → 8453 (0.1%)

Detailed changes :
+ src/shambase/include/shambase/print.hpp:26: warning: The following parameter of shambase::print(std::string_view sv) is not documented:
+ src/shambase/include/shambase/print.hpp:26: warning: argument 's' of command @param is not found in the argument list of shambase::print(std::string_view sv)
+ src/shambase/include/shambase/print.hpp:33: warning: The following parameter of shambase::println(std::string_view sv) is not documented:
+ src/shambase/include/shambase/print.hpp:33: warning: argument 's' of command @param is not found in the argument list of shambase::println(std::string_view sv)
+ src/shambase/src/print.cpp:23: warning: Member printer_t (typedef) of namespace shambase is not documented.
+ src/shambase/src/print.cpp:23: warning: Member printer_t (typedef) of namespace shambase is not documented.
+ src/shambase/src/print.cpp:24: warning: Member flush_t (typedef) of namespace shambase is not documented.
+ src/shambase/src/print.cpp:24: warning: Member flush_t (typedef) of namespace shambase is not documented.
- src/shambindings/src/pybindings.cpp:120: warning: Member init_state (variable) of namespace shambindings is not documented.
+ src/shambindings/src/pybindings.cpp:121: warning: Member init_state (variable) of namespace shambindings is not documented.
- src/shambindings/src/pybindings.cpp:123: warning: Member init(py::module &m) (function) of namespace shambindings is not documented.
+ src/shambindings/src/pybindings.cpp:124: warning: Member init(py::module &m) (function) of namespace shambindings is not documented.
- src/shambindings/src/pybindings.cpp:66: warning: Member register_py_to_sham_print(py::module &m) (function) of file pybindings.cpp is not documented.
+ src/shambindings/src/pybindings.cpp:67: warning: Member register_py_to_sham_print(py::module &m) (function) of file pybindings.cpp is not documented.

@tdavidcl tdavidcl merged commit d634b58 into Shamrock-code:main Apr 13, 2026
76 checks passed
@tdavidcl tdavidcl deleted the patch-2026-04-13-17-16 branch April 13, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant