Skip to content

Commit 5c99f49

Browse files
[4.x] Update README
1 parent eff1460 commit 5c99f49

1 file changed

Lines changed: 36 additions & 37 deletions

File tree

README.md

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,32 @@ Or manually update `require-dev` block of `composer.json` and run `composer upda
3737
```php
3838
use DragonCode\Benchmark\Benchmark;
3939

40-
// Массив без указания имён ключей
40+
// Array without named keys
4141
new Benchmark()->compare([
4242
fn () => /* some code */,
4343
fn () => /* some code */,
4444
])->toConsole();
4545

46-
// Массив с указанием имён ключей
46+
// Array with named keys
4747
new Benchmark()->compare([
4848
'foo' => fn () => /* some code */,
4949
'bar' => fn () => /* some code */,
5050
])->toConsole();
5151

52-
// Колбэки без указания имён свойств
52+
// Callbacks without named parameters
5353
new Benchmark()->compare(
5454
fn () => /* some code */,
5555
fn () => /* some code */,
5656
)->toConsole();
5757

58-
// Колбэки с указанием имён свойств
58+
// Callbacks with named parameters
5959
new Benchmark()->compare(
6060
foo: fn () => /* some code */,
6161
bar: fn () => /* some code */,
6262
)->toConsole();
6363
```
6464

65-
Пример вывода результата с указанием имён:
65+
Example output with named keys:
6666

6767
```bash
6868
+-------+-------------------------+-------------------------+
@@ -78,9 +78,8 @@ new Benchmark()->compare(
7878
```
7979

8080
When measuring the average value among the results, when more than 9 iterations are used, the final data is filtered by
81-
peak values. The calculation of the 10% of the lowest and
82-
10% of the highest values is excluded from the total result, thus the final data becomes cleaner and less dependent on
83-
any external factors.
81+
peak values. The calculation of the 10% of the lowest and 10% of the highest values is excluded from the total result,
82+
thus the final data becomes cleaner and less dependent on any external factors.
8483

8584
### Iterations Count
8685

@@ -99,15 +98,15 @@ new Benchmark()
9998
->toConsole();
10099
```
101100

102-
При передаче отрицательного значения, это значение будет взято по модулю.
101+
If a negative value is passed, its absolute value will be used.
103102

104-
Например:
103+
For example:
105104

106105
```php
107106
use DragonCode\Benchmark\Benchmark;
108107

109108
new Benchmark()
110-
->iterations(-20) // Будет 20 итераций
109+
->iterations(-20) // Will result in 20 iterations
111110
// ...
112111
```
113112

@@ -130,7 +129,7 @@ new Benchmark()
130129
By default, the script does not round measurement results, but you can specify the number of decimal places to which
131130
rounding can be performed.
132131

133-
Этот метод имеет влияние только на вывод результата в консоль (метод `toConsole`).
132+
This method only affects the console output (the `toConsole` method).
134133

135134
For example:
136135

@@ -165,9 +164,9 @@ Result example:
165164

166165
#### Before
167166

168-
В некоторых случаях нужно выполнить какие-либо действия до запуска цикла проверки.
167+
In some cases, you may need to perform certain actions before running the benchmark loop.
169168

170-
Сделать это можно путём вызова метода `before` с передачей колбэка.
169+
You can do this by calling the `before` method with a callback.
171170

172171
```php
173172
use DragonCode\Benchmark\Benchmark;
@@ -181,7 +180,7 @@ new Benchmark()
181180
->toConsole();
182181
```
183182

184-
При вызове колбэка ему передаются параметры имени цикла. Если это необходимо, можно использовать эту информацию.
183+
The loop name is passed to the callback as a parameter. You can use this information if needed.
185184

186185
```php
187186
use DragonCode\Benchmark\Benchmark;
@@ -197,9 +196,9 @@ new Benchmark()
197196

198197
#### BeforeEach
199198

200-
В некоторых случаях нужно выполнить какие-либо действия до запуска итерации проверки.
199+
In some cases, you may need to perform certain actions before each benchmark iteration.
201200

202-
Сделать это можно путём вызова метода `beforeEach` с передачей колбэка.
201+
You can do this by calling the `beforeEach` method with a callback.
203202

204203
```php
205204
use DragonCode\Benchmark\Benchmark;
@@ -213,9 +212,9 @@ new Benchmark()
213212
->toConsole();
214213
```
215214

216-
При вызове колбэка ему передаются параметры имени цикла и номер итерации.
217-
Также в сам колбэк передаётся результат выполнения колбэка `beforeEach`.
218-
Если это необходимо, можно использовать эту информацию.
215+
The loop name and iteration number are passed to the callback as parameters.
216+
Additionally, the result of the `beforeEach` callback is passed to the compare callback itself.
217+
You can use this information if needed.
219218

220219
```php
221220
use DragonCode\Benchmark\Benchmark;
@@ -231,9 +230,9 @@ new Benchmark()
231230

232231
#### After
233232

234-
В некоторых случаях нужно выполнить какие-либо действия после запуска цикла проверки.
233+
In some cases, you may need to perform certain actions after the benchmark loop has completed.
235234

236-
Сделать это можно путём вызова метода `after` с передачей колбэка.
235+
You can do this by calling the `after` method with a callback.
237236

238237
```php
239238
use DragonCode\Benchmark\Benchmark;
@@ -247,13 +246,13 @@ new Benchmark()
247246
->toConsole();
248247
```
249248

250-
При вызове колбэка ему передаются параметры имени цикла. Если это необходимо, можно использовать эту информацию.
249+
The loop name is passed to the callback as a parameter. You can use this information if needed.
251250

252251
```php
253252
use DragonCode\Benchmark\Benchmark;
254253

255254
new Benchmark()
256-
->before(fn (int|string $name) => /* some code */)
255+
->after(fn (int|string $name) => /* some code */)
257256
->compare(
258257
fn () => /* some code */,
259258
fn () => /* some code */,
@@ -263,9 +262,9 @@ new Benchmark()
263262

264263
#### AfterEach
265264

266-
В некоторых случаях нужно выполнить какие-либо действия до запуска итерации проверки.
265+
In some cases, you may need to perform certain actions after each benchmark iteration.
267266

268-
Сделать это можно путём вызова метода `afterEach` с передачей колбэка.
267+
You can do this by calling the `afterEach` method with a callback.
269268

270269
```php
271270
use DragonCode\Benchmark\Benchmark;
@@ -279,8 +278,8 @@ new Benchmark()
279278
->toConsole();
280279
```
281280

282-
При вызове колбэка ему передаются параметры имени цикла и номер итерации.
283-
Если это необходимо, можно использовать эту информацию.
281+
The loop name and iteration number are passed to the callback as parameters.
282+
You can use this information if needed.
284283

285284
```php
286285
use DragonCode\Benchmark\Benchmark;
@@ -296,13 +295,13 @@ new Benchmark()
296295

297296
### Results
298297

299-
Для получения результата бенчмарка воспользуйтесь одним из методов.
298+
Use one of the following methods to obtain benchmark results.
300299

301300
#### toConsole
302301

303-
Этот метод выведет результат выполнения бенчмарка в консоль.
302+
This method outputs the benchmark results to the console.
304303

305-
##### Вариант 1
304+
##### Option 1
306305

307306
```php
308307
new Benchmark()
@@ -327,7 +326,7 @@ new Benchmark()
327326
+-------+---------------------+----------------------+
328327
```
329328

330-
##### Вариант 2
329+
##### Option 2
331330

332331
```php
333332
new Benchmark()
@@ -352,7 +351,7 @@ new Benchmark()
352351
+-------+----------------------+----------------------+
353352
```
354353

355-
##### Вариант 3
354+
##### Option 3
356355

357356
```php
358357
new Benchmark()
@@ -377,7 +376,7 @@ new Benchmark()
377376
+-------+----------------------+----------------------+
378377
```
379378

380-
##### Вариант 4
379+
##### Option 4
381380

382381
```php
383382
new Benchmark()
@@ -404,9 +403,9 @@ new Benchmark()
404403

405404
#### toData
406405

407-
Этот метод выведет результат бенчмарка в массив DTO объектов `DragonCode\Benchmark\Data\ResultData`.
406+
This method returns benchmark results as an array of `DragonCode\Benchmark\Data\ResultData` DTO objects.
408407

409-
Его можно использовать в приложении для Ваших нужд.
408+
You can use it in your application for your own purposes.
410409

411410
```php
412411
return new Benchmark()
@@ -460,7 +459,7 @@ array:2 [
460459

461460
#### toAssert
462461

463-
Этот метод позволяет проверить результаты бенчмарка на соответствие ожидаемым значениям.
462+
This method allows you to validate benchmark results against expected values.
464463

465464
```php
466465
use DragonCode\Benchmark\Benchmark;

0 commit comments

Comments
 (0)