Skip to content

cgen: reduce expense in repetitively called functions by using consts#19732

Merged
spytheman merged 1 commit intovlang:masterfrom
ttytm:cgen/perf-refact
Nov 2, 2023
Merged

cgen: reduce expense in repetitively called functions by using consts#19732
spytheman merged 1 commit intovlang:masterfrom
ttytm:cgen/perf-refact

Conversation

@ttytm
Copy link
Copy Markdown
Member

@ttytm ttytm commented Nov 1, 2023

Those functions can be called quite often since the check nodes.

Using a constant declaration for the arrays with static data, instead of re-defining them per call, makes them a little cheaper.

🤖 Generated by Copilot at 0d659fa

Refactor C code generation for generic functions and methods in vlib/v/gen/c/fn.v by using a constant to escape generic brackets.

🤖 Generated by Copilot at 0d659fa

  • Define a constant c_fn_name_escape_seq to hold the characters to be replaced in generic function names (link)
  • Use c_fn_name_escape_seq instead of literal arrays to replace generic brackets in receiver and parameter type names of methods and functions (link, link)

@spytheman spytheman merged commit eb74856 into vlang:master Nov 2, 2023
@ttytm ttytm deleted the cgen/perf-refact branch November 2, 2023 13:02
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.

2 participants