Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commite83b2ff

Browse files
committed
[symfony#2586] Documented setRedrawFrequenty()
1 parentb57f2ab commite83b2ff

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

‎components/console/helpers/progresshelper.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,20 @@ To see other available options, check the API documentation for
5656

5757
..caution::
5858

59-
For performance reasons, be careful to not set the total number of steps
60-
to a high number. For example, if you're iterating over a large number
61-
of items, consider a smaller "step" number that updates on only some
62-
iterations::
59+
For performance reasons, be careful if you set the total number of steps
60+
to a high number. For example, if you're iterating over a large number of
61+
items, consider setting the redraw frequency to a higher value by calling
62+
:method:`Symfony\\Component\\Console\\Helper\\ProgressHelper::setRedrawFrequency`,
63+
so it updates on only some iterations::
64+
65+
$progress->start($output, 50000);
66+
67+
// update every 100 iterations
68+
$progress->setRedrawFrequency(100);
6369

64-
$progress->start($output, 500);
6570
$i = 0;
6671
while ($i++ < 50000) {
6772
// ... do some work
6873

69-
// advance every 100 iterations
70-
if ($i % 100 == 0) {
71-
$progress->advance();
72-
}
73-
}
74+
$progress->advance();
75+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp