Welcome Guest, Not a member yet? Register   Sign In
Ajax response time higher than with CI3
#1

Hello,

Recently i've worked on rewriting my web app with a lot of ajax calls to CI4. I noticed that response times are higher than when i used a CI3. Differences were not so much annoying but they were puzzling. With CI3 on my web app ajax call response times were around 70-90ms while with CI4 they were around 120-140ms. I thought that maybe there were a problem with something other like a queries to database or sth... (but it would be confusing because i rewrote 1:1 previous web app). So i made a test controller with a test view with ajax call.

Simple controller:
PHP Code:
public function test1() {
 
$array = array();
 
$object = new stdClass();
 
$object -> time time();
 
array_push$array$object );

 echo 
json_encode$array );
 } 

And a simple ajax call:
Code:
$( document ).ready( function() {
$( '#test' ).bind( 'submit', function( e ) {
e.preventDefault();

var data = {};

$.ajax( {
type: 'POST',
url: '<?php echo base_url( 'Test/test1' ); ?>',
success: function( response ) {
console.log( response );

$.each( response, function( i ) {
$( '#test_table' ).prepend( $( '<tr>' )
.append( $( '<td>' )
.append( response[i].time )
)
);
} );
},
error: function( xhr, ajaxOptions, thrownError ) {
console.log( thrownError );
}
} );
} );
} );

And i made tests. CI3 ajax call response times: 30-50ms while CI4: 60-80ms. CI4 environment were ofcourse set to production. On environment set to development they were even higher... Is there any explanation why is that?
Reply


Messages In This Thread
Ajax response time higher than with CI3 - by Yoko - 08-10-2021, 11:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB