[go: up one dir, main page]

Minor string optimizations

This MR contains two changes related to String usage:

  1. Change utils::string_from_bytes to validate UTF-8 string first and then do heap allocation. This avoids unnecessary memory allocation and memory copy with invalid strings.
  2. Switch from utils::string_from_bytes to str::from_utf8 in places where &str is enough and String is unnecessary. This avoid copying data to pass a str reference forward.

  • I agree to release my code and all other changes of this MR under the Apache-2.0 license

Merge request reports

Loading