Skip to content

Commit c5eb885

Browse files
Merge pull request #101
Update README: Adjust parameter format for benchmarking methods to improve clarity
2 parents 0f3e9fc + fa08283 commit c5eb885

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -655,18 +655,19 @@ new Benchmark()
655655
->compare(/* ... */)
656656
->toAssert()
657657

658-
->toBeMinTime(0.5, 3) // between 0.5 and 3 ms
659-
->toBeMaxTime(0.5, 3) // between 0.5 and 3 ms
660-
->toBeAvgTime(0.5, 3) // between 0.5 and 3 ms
661-
->toBeTotalTime(0.5, 9) // between 0.5 and 9 ms
658+
->toBeMinTime(from: 0.5, till: 3) // between 0.5 and 3 ms
659+
->toBeMaxTime(from: 0.5, till: 3) // between 0.5 and 3 ms
660+
->toBeAvgTime(from: 0.5, till: 3) // between 0.5 and 3 ms
661+
->toBeTotalTime(from: 0.5, till: 9) // between 0.5 and 9 ms
662662

663-
->toBeMinMemory(0, 1024) // between 0 and 1024 bytes
664-
->toBeMaxMemory(0, 1024) // between 0 and 1024 bytes
665-
->toBeAvgMemory(0, 1024) // between 0 and 1024 bytes
666-
->toBeTotalMemory(0, 4096); // between 0 and 4096 bytes
667-
```
663+
->toBeMinMemory(from: 0, till: 1024) // between 0 and 1024 bytes
664+
->toBeMaxMemory(from: 0, till: 1024) // between 0 and 1024 bytes
665+
->toBeAvgMemory(from: 0, till: 1024) // between 0 and 1024 bytes
666+
->toBeTotalMemory(from: 0, till: 4096) // between 0 and 4096 bytes
668667

669-
You can also use a single value:
668+
->toBeDeviationTime(from: -0.5, till: 0.5) // deviation time must be between -0.5% and 0.5%
669+
->toBeDeviationMemory(from: -2.5, till: 2.5) // deviation memory must be between -2.5% and 2.5%
670+
```
670671

671672
```php
672673
use DragonCode\Benchmark\Benchmark;
@@ -675,15 +676,18 @@ new Benchmark()
675676
->compare(/* ... */)
676677
->toAssert()
677678

678-
->toBeMinTime(0.5) // time must be greater than or equal to 0.5 ms
679-
->toBeMaxTime(0.5) // time must be greater than or equal to 0.5 ms
680-
->toBeAvgTime(0.5) // time must be greater than or equal to 0.5 ms
681-
->toBeTotalTime(0.5) // time must be greater than or equal to 0.5 ms
679+
->toBeMinTime(from: 0.5) // time must be greater than or equal to 0.5 ms
680+
->toBeMaxTime(from: 0.5) // time must be greater than or equal to 0.5 ms
681+
->toBeAvgTime(from: 0.5) // time must be greater than or equal to 0.5 ms
682+
->toBeTotalTime(from: 0.5) // time must be greater than or equal to 0.5 ms
682683

683684
->toBeMinMemory(till: 1024) // the memory footprint should not exceed 1024 bytes
684685
->toBeMaxMemory(till: 1024) // the memory footprint should not exceed 1024 bytes
685686
->toBeAvgMemory(till: 1024) // the memory footprint should not exceed 1024 bytes
686-
->toBeTotalMemory(till: 4096); // the memory footprint should not exceed 4096 bytes
687+
->toBeTotalMemory(till: 4096) // the memory footprint should not exceed 4096 bytes
688+
689+
->toBeDeviationTime(from: -0.5) // deviation time must be greater than or equal to -0.5%
690+
->toBeDeviationMemory(till: 2.5) // deviation memory must be less than or equal to 2.5%
687691
```
688692

689693
### Disable Progress Bar

0 commit comments

Comments
 (0)