Is calling a function from a phar file faster then calling functions from php files?

StackOverflow https://stackoverflow.com/questions/22270720

  •  11-06-2023
  •  | 
  •  

سؤال

What is faster to execute? Using a Phar file and calling the functions out of the phar file like this:

<?php
include 'phar://lib.phar/lib.php';

RandomClass::sayMessage("Hello");

Or using the regular old way like doing this:

<?php
include 'lib.php';

RandomClass::sayMessage("Hello");

Will the phar have a performance boost/slowdown in calling functions? (Not in my example)

هل كانت مفيدة؟

المحلول

There is not going to be any performance difference.

By the time the function call is allowed to go through, the function has already been compiled and is in memory. Where it came from will not play a role.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top