3

Good day!

I test phalcon in my project. I thought, it's very faster then others. But...

Look at my test

$app = new Micro($di);
$app->get('/', function () use ($app) {
    $users = $app->modelsManager->executeQuery("SELECT * FROM TEST WHERE NAME IN ('L488', '1K5T', '4QYS' , '9ECV')");
    $data = array();
    foreach ($users as $user) {
        $data[] = array(
            'name' => $user
        );
    }
    echo json_encode($data, JSON_UNESCAPED_UNICODE);
});

And my model

use Phalcon\Mvc\Model;

class TEST extends Model {

    public $name;

    public function initialize() {
        $this->setSource("TEST");
    }

}

The query execution time is 1.2-1.5 s. Now without phalcon

$user = 'name';
$pass = 'pass';

$dbh = new PDO('oci:dbname=orcl', $user, $pass);
$users = $dbh->query("SELECT * FROM TEST WHERE NAME IN ('L488', '1K5T', '4QYS' , '9ECV')");

$data = array();
    foreach ($users as $user) {
        $data[] = array(
            'name' => $user
        );
    }

echo json_encode($data, JSON_UNESCAPED_UNICODE);

The query execution time is 600-700 ms WTF? How it can be? Why phalcon modelsManager slower

1 Answer 1

4

This question has been answered on the Phalcon forum.

What you're testing here with Micro app is just database, not Phalcon. Your query kills RDBMS, that's not optimizied at all. Any overhead you might get is by using Phalcon's ORM, so yeah - ORM will always add overhead if you compare with plain PDO. -- stamster

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.