php - CodeIgniter performance issues with large form -


i using codeigniter , have performance issues large form. can reach 1,000 fields because it's used data entry (many of fields have same value user spends less 30min filling client-side code).

it takes less second show form populated db. when user clicks on submit, exact same code takes post data instead of db data takes forever , times out. works fine few hundred fields (taking less 15s submit/insert in db) if number of fields doubled takes much, longer.

there 3 parts in code (which won't copy here because it's long , complex due logic involved in many fields):

  1. prepare data (from db or form) inside objects
  2. form validation using $this->form_validation->run()
  3. db inserts/edits

part 1 fast when data read db edit. when data comes post, never reaches part 2 it's not issue form validation or db inserts.

as message, think issue comes xss protection codeigniter:

maximum execution time of 90 seconds exceeded in (...)/system/core/security.php 

do know if using of these bit slow? $this->post->input('fieldname', true) , $this->input->post(null, true). codeigniter lot of calculations each time use them , should therefore save each post input variable before using them in calculations?

alternatively turn off xss protection since it's in our admin part i'd not go way.

or maybe it's not @ , code somehow poor?

problem solved! added @ start of controller:

if($this->input->post(null,true)) $haspost = true; else $haspost = false; 

and replaced every single instance of if($this->input->post(null,true)) {do stuff} if($haspost) {do stuff}.

it takes under second submit... issue using if($this->input->post(null,true)) check if there post data codeigniter ran xss cleaning on fields each time.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -