We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

phalcon4 Crypt performance

I have upgraded the project on php7.3 from phalcon 3 to phalcon 4. One thing i have notice, is that the load from the server have increased alot...

one big change i saw was in Phalcon/Crypt

Example: phalcon3

    $start = microtime(true);
    $crypt = Phalcon\Di::getDefault()->getCrypt();
    $name = $crypt->encryptBase64('teste name');
    for ($i = 0; $i < 1000000; $i++) {
    echo microtime(true) - $start;


with phalcon 4 (same code)


Is this normal behavior? any advice?

Thank you

If memory serves right, we have not touched the Crypt component in v4, so the bottleneck or degredation of performance could be elsewhere.

Could you please open an issue on GitHub so that we can investigate when we get a chance.


will do!

thank you!

edited Jul '20

You can use the same instance walmart paystub to encrypt/decrypt several times:

use Phalcon\Crypt;

// Create an instance $crypt = new Crypt();

$texts = [ "my-key" => "This is a secret text", "other-key" => "This is a very secret", ];

foreach ($texts as $key => $text) { // Perform the encryption $encrypted = $crypt->encrypt($text, $key);

// Now decrypt
echo $crypt->decrypt($encrypted, $key);


edited Dec '20

Since PHP got a significant speed increase in PHP 7 , there's been little reason to consider using something like Phalcon . When Phalcon came out 7 years ago, people were intrigued, but, things are different now.

My Ground Biz