`toPath` is very expensive
asazernik opened this issue · comments
Almost all of the execution time of registerField()
is spent in toPath()
, specifically on the string-splitting.
As this is modeled after lodash, I looked at their implementation. Being lodash, they hand-rolled a tokenizer, but even so they felt it necessary to memoize the thing, indicating that this is just an inherently expensive operation.
Since no-deps is a goal, I see three options:
- Hand-roll our own memoization support
- Include a copy of lodash's memoize in our build (see if the build system will handle this for us)
- Include a copy of lodash's stringToPath in our build (again, see if the build system will deal with this)
Are you submitting a bug report or a feature request?
What is the current behavior?
What is the expected behavior?
Sandbox Link
What's your environment?
Other information
I was profiling my app today (which uses deeply nested paths) and came to same conclusion regarding the toPath-function performance (and the need for memoization). It there any update to this issue or plans for a fix in near future?