Comparison with Php along Codeigniter and Laravel Framework

METHODOLOGY

In this study an experiment is conducted in which five functionally equivalent web applications representing a simple blog are developed. The first web application is developed using plain PHP and the second one is developed using CODEIGNITER framework and last one is developed using Laravel framework

In the experiments, execution time and the consumed memory usage when executing the CREATE, READ, UPDATE and DELETE (CRUD) implementation in each web application of the experiment will be measured. The memory usage and the execution time is measured in plain php by using the built in functions in php scripts. The codeigniter framework also has the built in functions for memory usage and execution time measurement and also codes are available for the laravel framework to measure the memory usage and execution time for the four functions.

Our research will answer the following basic question:

How does memory usage and execution time differs for a simple blog web application developed in plain php and the one developed with codeigniter framework.

SIMULATION

The two web applications developed will be tested in terms of their execution time and memory usage. The two measurements have been done on the basis of CRUD i.e. create, read, update, delete. These are the basic function of any web application.

Create action- The measurement starts in the create-blog-entry view when the user has pressed the create-blog-entry button after the form has been filled in. Once done, the newly created blog entry is presented in view-blog-entry view and the measurement is stopped.

View action- The measurement starts when the link responsible to show the blog entry is clicked and ends when the controller views the blog entry. This happens in the index page where only one blog entry is created. Once the view is rendered, the measurement is stopped.

Update action- The measurement starts when the updating input data is posted from the update-blog-entry view using a submission button. The measurement ends when the updated blog entry is shown in a view-blog-entry view.

Delete action- The measurement starts when the delete button in a view-blog-entry view is pressed and ends after the index page has been rendered completely with the information confirming that the deletion was successful.

RESULT AND ANALYSIS

The results from the conducted experiments are presented and analyzed. The presentation is outlined in a tabular form in which the horizontal columns represent the tested actions Create, Read, Update and Delete. For each tabular form there is a corresponding visual presentation in a form of a graph.

Execution time experiment result- The results show that codeigniter has more execution time during the create and update action but it takes less time during view and delete action. Although plain php is only fast by a few milliseconds which will be almost ignored by the user. But we can see that LARAVEL performs well and has less execution time for all the four actions. The results of the ten inputs as a mean for the four actions are presented below:

TESTED TARGETS CREATE READ UPDATE DELETE
PLAIN PHP 0.066 0.063 0.0925 0.065
CODEIGNITER 0.0634 0.0747 0.0825 0.616
LARAVEL 0.201 0.222 0.312 0.301

Memory Usage Experiment Result- The results of memory usage experiment is such that codeigniter uses a fixed memory for all the four actions of create, read, update and delete, but the memory used by plain php blog varies everytime for all the actions but laravel uses more memory in all the four functions. The values have been plotted in the tabular form. The tabular form is also represented in visual form as a graph.

TABLE 2: Memory Usage experiment results table

TESTED TARGETS CREATE READ UPDATE DELETE
PLAIN PHP 3.24 3.67 3.45 3.80
CODEIGNITER 3.78 3.78 3.78 3.78
LARAVEL 6.025 5.01 5.025 5.022

To answer the research questions defined below:

(1) How does execution time and memory usage differ for a simple blog web application written in plain PHP and the Codeigniter framework?

(2) What will be more reliable for the development of web applications?

It would initially be stated that the following text would be considered as an answer for both research questions. The reason for that is that the questions are conditional, where the second research question (RQ2) is depended on the outcome of the first research question (RQ1). So therefore, the result analysis for the plain PHP and Codeigniter shows that the differences between them are relatively small to plain PHP’s advantage. The plain PHP is only a dozens milliseconds faster and consumes a few bytes less memory than Codeigniter but if we see the LARAVEL version we can see that laravel takes minimum time than both codeigniter and procedural php.If the plain PHP application was large, it would mean that the plain PHP would not have been performing better than the Codeigniter and codeigniter also will not be able to perform as efficiently as LARAVEL because as the application will get bigger LARAVEL performance will be getting better as a result LARAVEL execution time measurement is better than both.In the case of memory usage laravel takes much larger time than both procedural php and codeigniter but as the application gets bigger it would be easy to effort memory but execution time should be of much importance. That is because the growth of the stack trace in the plain PHP application would have caused a higher execution time and memory consumption. Plain PHP is mostly suited for smaller projects even if there are no obvious reasons to not use Codeigniter or laravel, but Codeigniter and laravel would be the preferred choice when developing larger projects.