Skip to content

Conversation

chqrlie
Copy link
Collaborator

@chqrlie chqrlie commented May 7, 2024

String values are allocated as temporary or final results. This commit attempts to improve the consistency and performance of this step.

  • define JS_NewString as an inline function to allow simple expansion of strlen() for string literals
  • document string contents constraints regarding UTF-8 encoding.
  • rename js_new_string8 as js_new_string8_len. takes const char *.
  • new inline function js_new_string8 takes const char *, computes string length with strlen and calls js_new_string8_len. No overhead for string literals
  • use internal string allocation functions where appropriate, remove overhead
String values are allocated as temporary or final results. This commit attempts to improve the consistency and performance of this step. - define `JS_NewString` as an inline function to allow simple expansion of `strlen()` for string literals - document string contents constraints regarding UTF-8 encoding. - rename `js_new_string8` as `js_new_string8_len`. takes `const char *`. - new inline function `js_new_string8` takes `const char *`, computes string length with `strlen` and calls `js_new_string8_len`. No overhead for string literals - use internal string allocation functions where appropriate, remove overhead
Copy link
Contributor

@saghul saghul left a comment

Choose a reason for hiding this comment

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

All goood! 🚀

@chqrlie chqrlie merged commit b81d4de into quickjs-ng:master May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants