Closed Ginni1110 closed 1 year ago
Creating regular expressions allocates a new object each time. Hoist the regular expression creation outside the loop, and you may see a significant speed up.
Put this line outside the loop:
var re = /\t66EKZPb9ZjErsgZpMO8hrvs9gSOIrWb8a7OiNH6ylgnSovuXjKZGHyEDywxBzvzucleEdRWHhe0uLmWBoYvZ5SYdiShZcwrJSm4b?/i;
PS. Oh, you changed the example.
In the new example, there's nothing more to do. MuJS is sometimes just slower than other engines.
thank you~I want to know about the loop optimization part, does mujs have any plans to improve:)In addition, in the original example, if the regular expression definition is not placed outside the loop, has mujs considered optimization in this regard?
version:1.3.7
Overview:
If a method is called frequently in a loop of thousands of times, the execution time of mujs is longer than other engines. So what is the reason for this and can it be optimized.
TestCase:
Execution time:
mujs: 2186 ms
hermes: 96 ms
quickjs: 773 ms