EasyUI Forum

General Category => EasyUI for React => Topic started by: chrwei on February 04, 2020, 02:50:13 PM



Title: Form.validate() performance
Post by: chrwei on February 04, 2020, 02:50:13 PM
I have a complex form with about 50 fields, but only 20 of them have rules, though I'll likely expand that.

when i call validate(), whether or not there are any rule errors, I'm seeing a fairly consistent 4.5 second delay on an N3350 Chromebook and 1.2 second delay on an i5-8400.  latest Chrome browser versions.  my timing is logging `Date().getTime()` on the line before calling validate and again on the first line in the callback.  1 second I can deal with, 4 seconds I cannot.

I do have a custom validateRules and most of the 20 fields do have more than one. 

in testing, I've changed it to "rules={{}}" and the delay remains, so I don't see how it could be my rules, which aren't very complex.  I've also removed "rules={myModelrules}" and the callback is never called, which I guess is expected, but it is very fast.



Title: Re: Form.validate() performance
Post by: chrwei on April 10, 2020, 05:26:13 PM
I'm still finding this to be an issue. I've optimized so that it doesn't call the full validate very often, and that helps, but in some cases it just needs done.

is my only option to split it into multiple forms and hope I don't need to validate more than one form in any given process?


Title: Re: Form.validate() performance
Post by: chrwei on April 20, 2020, 08:54:24 AM
I think I've worked out what's killing performance on this, at least in my case.

it's looping ALL fields and checking if they have a rule.  it would be a lot faster if it looped the rules and check for the fields, as not all fields have rules.