final-form icon indicating copy to clipboard operation
final-form copied to clipboard

`toPath` is very expensive

Open asazernik opened this issue 6 years ago • 1 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:

  1. Hand-roll our own memoization support
  2. Include a copy of lodash's memoize in our build (see if the build system will handle this for us)
  3. 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

asazernik avatar Sep 11 '19 00:09 asazernik

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?

eriihine avatar Nov 28 '19 15:11 eriihine