Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance: Avoid string-allocation on keypress with inputRule (#47094)
While checking for inline code snippets surrounded by the backtick we have been allocating new substrings from input strings when looking for those characters, but we don't need to do this. In this patch we're directly checking for the character on the input string using string indexing and then passing the `position` parameter to the `lastIndexOf` function so that it is able to scan the original input string without copying it. The performance impact of this change should be small and hard to measure, but it should reduce pressure on the garbage collector and be worthwhile even without clear measured results.
- Loading branch information