Flow\JSONPath\Test\JSONPathBenchmarks::testBenchmark4 PHP Méthode

testBenchmark4() public méthode

public testBenchmark4 ( )
    public function testBenchmark4()
    {
        $goessnerJsonPath = new PeekmoJsonPath();
        $exampleData = $this->exampleData();
        $start1 = microtime(true);
        for ($i = 0; $i < 100; $i += 1) {
            $results1 = $goessnerJsonPath->jsonPath($exampleData, '$..price');
        }
        $end1 = microtime(true);
        $exampleData = $this->exampleData(true);
        $start2 = microtime(true);
        for ($i = 0; $i < 100; $i += 1) {
            $results2 = (new JSONPath($exampleData))->find('$..price');
        }
        $end2 = microtime(true);
        $this->assertEquals($results1, $results2->data());
        echo "Old JsonPath: " . ($end1 - $start1) . PHP_EOL;
        echo "JSONPath: " . ($end2 - $start2) . PHP_EOL;
    }