Skip to content

C: Optimize hb_string() to compute length at compile time#1318

Merged
marcoroth merged 2 commits intomainfrom
hb-string-macro
Mar 7, 2026
Merged

C: Optimize hb_string() to compute length at compile time#1318
marcoroth merged 2 commits intomainfrom
hb-string-macro

Conversation

@marcoroth
Copy link
Owner

@marcoroth marcoroth commented Mar 7, 2026

This pull request converts the hb_string() function to a macro and renames the existing hb_string function to hb_string_from_c_string.

We do this in order to optimize hb_string() calls with static string literals so that they have no runtime-overhead for converting a C-String to a hb_string_T.

This applies for calls like:

hb_string("<%")
hb_string("%>")

For dynamic strings it will fallback to hb_string_from_c_string():

hb_string(variable)
hb_string(message)

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 7, 2026

npx https://pkg.pr.new/@herb-tools/formatter@1318
npx https://pkg.pr.new/@herb-tools/language-server@1318
npx https://pkg.pr.new/@herb-tools/linter@1318

commit: 09a9a8c

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

🌿 Interactive Playground and Documentation Preview

A preview deployment has been built for this pull request. Try out the changes live in the interactive playground:


🌱 Grown from commit 09a9a8c


✅ Preview deployment has been cleaned up.

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