Skip to content

make_qualified_base_name: qbn string view#419

Merged
villagestevers merged 2 commits intovillagesql:mainfrom
pyshx:pyshx/qbn-string-view
May 5, 2026
Merged

make_qualified_base_name: qbn string view#419
villagestevers merged 2 commits intovillagesql:mainfrom
pyshx:pyshx/qbn-string-view

Conversation

@pyshx
Copy link
Copy Markdown
Contributor

@pyshx pyshx commented May 1, 2026

Description

make_qualified_base_name (villagesql/schema/systable/helpers.h:55) takes const std::string&, but its callers in util.cc:1289, 1332, 1420 pass (const std::string ext_name, const char *) — the const char * is silently wrapped in a temporary std::string to satisfy the signature. Switching to std::string_view lets all current callers pass through unchanged (std::string and const char * both convert implicitly) while removing those hidden allocations.

Two other callers — type_descriptor.h:156 and dd/dd_routine.cc:89 — pass (const std::string&, const std::string&) from accessor methods; those also remain unchanged.

Related Issue

Closes #416.

How was this tested?

  • Debug build clean (make -j12)
  • ./scripts/villint.sh --commit upstream/main clean
  • ctest -L villagesql — 7/7 villagesql unit tests pass
  • MTR --do-suite=village --nounit-tests --parallel=auto — 552 tests pass, 8 skipped, 0 failures
  • MTR --suite=villagesql/examples/vsql-tvector — 6/6 pass
  • MTR --suite=villagesql/examples/vsql-complex — 7/7 pass

Checklist

  • I have signed the CLA
  • I have read CONTRIBUTING.md
  • I have added or updated tests as appropriate
  • My changes maintain compatibility with upstream MySQL 8.4

The function takes const std::string& but its callers in util.cc:1289,
1332, 1420 pass `(const std::string ext_name, const char *)` — the
const char* is silently wrapped in a temporary std::string. Switching
to std::string_view lets all current callers pass through unchanged
(std::string and const char* both convert implicitly) while removing
those hidden allocations.

Closes villagesql#416. Surfaced in villagesql#257 review thread; villagesql#408 deferred this.
@pyshx pyshx changed the title make_qualified_base_name: use std::string_view make_qualified_base_name: use std::str_view May 1, 2026
@pyshx pyshx changed the title make_qualified_base_name: use std::str_view make_qualified_base_name: qbn string view May 1, 2026
@villagestevers villagestevers self-requested a review May 4, 2026 14:32
Comment thread villagesql/schema/systable/helpers.h
Per maintainer review: the std::string_view conversion in PR villagesql#419 left
the body constructing two std::string temporaries plus operator+
intermediates — 2-4 allocations to do what should be 0-1. Switch to
reserve + append/push_back for a single allocation when the result
exceeds SSO.
@villagestevers villagestevers merged commit aa7d4d2 into villagesql:main May 5, 2026
3 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Server]: make_qualified_base_name should take std::string_view

2 participants