Skip to content

In verbose mode, add the execution time of fixtures #445

@florentdestremau

Description

@florentdestremau

Hi, I did a local trick to try and optimize our fixtures performance, it's pretty nice to see where you fixture time is going.

image

The trick is as simple as it gets, but I wonder how I could enable this only in verbose mode:

//src/Executor/ORMExecutor.php

    public function execute(array $fixtures, $append = false)
    {
        $executor = $this;
        $this->em->wrapInTransaction(static function (EntityManagerInterface $em) use ($executor, $fixtures, $append) {
            if ($append === false) {
                $executor->purge();
            }

            foreach ($fixtures as $fixture) {
                $start = microtime(true);
                $executor->load($em, $fixture);
                $end = microtime(true);
                $executionTime = $end - $start;
                echo 'Execution Time: ' . $executionTime . PHP_EOL;
            }
        });
    }

My issue here is that it's overlapping the bundle and the library and I don't see any easy hook to catch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions