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 10d ago

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);