I am building an App in CodeIgniter. I have a controller API and then It has got around 300 functions.
I wonder if this is an issue in terms of performance. Any body can help ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A very large controller would take longer to parse. Every time any method from your Controller is called, the controller class is invoked and instantiated and thus the entire controller has to be parsed (Better put, the fat controller needs to be parsed in its entirity once per request). Parsing a larger file will take longer, however the additional time will be very minute.
This is the only disadvantage I can think of in terms of performance.
There are, of course, a host of maintenance issues.
Explanation of ‘Class in instantiated every time you call one of its methods’
URL routing in CodeIgniter works this way:
example.com/controller/methodSo when you visit
example.com/user/createcreateis a function in the controller classuser. To call thecreatemethod,userclass has to first be instantiated, and then the method is called.If your controller class has 200 other functions, they need to be parsed as well.
If you now point your browser to
example.com/user/deleteThe previous instantiation of the class no longer exists. The entire class needs to be parsed again.