Performance issue using Symfony2 form component

I have a performance problem using Symfony2 Form Component, I use this component to create a form containing 300 checkboxes. This form must be flexible (the flag must be created in the SET_DATA event using this data tree. I also use subscribers to make my form flexible.

Problem:

  • Form generation took an average of 900 ms (which is a significant amount of time given the size of the input)
  • Binding my form took much longer (average 1 sec)

Assumptions:

  • The PathMapper property takes too long to create paths and look for the correct one to receive error messages during validation.

My question is:

  • If you have a problem with PropertyPath, do you know how to fix it? If not, any ideas on how to optimize my form?

Our code:

I created github Gist> https://gist.github.com/2867617

  • data.array is the data format we use to create our search form. (a tree can have many sub-levels and is created from our database)
  • SearchType.php is our main type of search
  • The other classes we use help us iterate and create all the elements of the search criteria.

PS: We are using Symphony2 version 2.0.15,

Thanks,

+4
source share
1 answer
  • You can solve the first problem by caching the generated html form using Memcache. Remember to invalidate the cache index after saving the form.
  • With a second problem Use a profiler to check what has been going on for so long; it could be a Doctrine hydration problem.
+1
source

Source: https://habr.com/ru/post/1414845/


All Articles