4

I have a performance issue using Symfony2 Form Component, I'm using this component to create a form which contains 300 checkbox(s). This form must be flexible (The checkbox(s) should be created on a SET_DATA event using a given data tree. I'm also using Subscribers to make my form flexible.

The problem:

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

Assumptions:

  • The propertyPathMapper is taking too much time to create paths and look for the right one to get error messages on validation.

My Question:

  • In the case of the PropertyPath issue, do you know how to fix it? If it's not, any ideas on how to optimize my form?

Our Code:

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

  • data.array is the data format we are using to generate our search form. (the tree can have many sub levels & is created from our database)
  • SearchType.php is our main Search Type
  • The other classes we are using are helping us to iterate on and generate all the search criteria elements.

PS: We are using the 2.0.15 version of Symfony2 ,

Thanks,

1 Answer 1

1
  • You can solve first problem by caching the generated form html with Memcache. Remember to invalidate the cache index after saving the form.
  • With the second problem Use a profiler to check what is taking so long, it may be Doctrine hydration issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.