Skip to content

Make Backtrace optional #205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2020

Conversation

norberttech
Copy link
Member

@norberttech norberttech commented Jul 18, 2020

Resolves #201

Blacfire profiles, as expected VoidBacktrace is way faster.

Both profiles executed against following code:

// $backtrace = new VoidBacktrace();
// $backtrace = new InMemoryBacktrace();

$matcher = (new MatcherFactory())->createMatcher($backtrace);

$value = [
    'users' => [
        [
            'id' => 1,
            'firstName' => 'Norbert',
            'lastName' => 'Orzechowicz',
            'enabled' => true,
        ],
        [
            'id' => 2,
            'firstName' => 'Michał',
            'lastName' => 'Dąbrowski',
            'enabled' => true,
        ],
    ],
    'readyToUse' => true,
    'data' => new stdClass(),
];

$pattern = [
    'users' => [
        [
            'id' => '@integer@',
            'firstName' => '@string@',
            'lastName' => 'Orzechowicz',
            'enabled' => '@boolean@',
        ],
        [
            'id' => '@integer@',
            'firstName' => '@string@',
            'lastName' => 'Dąbrowski',
            'enabled' => '@boolean@',
        ],
    ],
    'readyToUse' => true,
    'data' => '@wildcard@',
];


for ($i = 0; $i < 100; $i++) {
    $matcher->match($value, $pattern);
}

@norberttech norberttech merged commit 60c1b8c into coduo:5.x Jul 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHPMatcherConstraint outputs backtrace if assertion fails
1 participant