Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow comparing two (or more) different benchmark methods to each other in the same run. #1120

Copy link
Copy link

Description

@stepo2
Issue body actions

Let's say I have two functions that do the same, on different ways:

final class MathUtil
{
    public static function heavyCalculationWayOne(): float
    {
       // ...
    }

    public static  function heavyCalculationWayTwo(): float
    {
       // ...
    }
}

And then I benchmark both with the same revolutions and/or iterations.

final class HeavyCalcBench
{
    function benchWayOne(): void
    {
        MathUtil::heavyCalculationWayOne();
    }
    
    function benchWayTwo(): void
    {
        MathUtil::heavyCalculationWayTwo();
    }
}

It would be nice if one could somehow mark one as the baseline for the others inside a single phpbench run process. To easily see on a single glance if or which one performs better. Currently I have to evualate the runtimes, memory, standard deviations, ... of both manually to each other. Basically what regression testing is doing but instead inside a single run on method level.

An example use-case is when a computationally heavy task is to be solved and different devs try their approaches - to then decide which makes it into the final product. Another one: on new PHP major versions, to check if the PHP interpreter can now handle both ways roughly the same as fast, so a real-world application can now use the better readible/maintainable method instead of the unreadible-but-more-optimized one.

Reactions are currently unavailable

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

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.