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

PapaRoach
  • 51
  • 1

1 Answers1

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

Timothy
  • 2,004
  • 3
  • 23
  • 29
  • Also it is possible to [speed up this query anyway](http://stackoverflow.com/questions/28755079/phalcon-performance-related-queries) – yergo Jun 03 '16 at 07:12