Skip to content

Documented setRedrawFrequenty() #2588

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
May 5, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions components/console/helpers/progresshelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,20 @@ To see other available options, check the API documentation for

.. caution::

For performance reasons, be careful to not set the total number of steps
to a high number. For example, if you're iterating over a large number
of items, consider a smaller "step" number that updates on only some
iterations::
For performance reasons, be careful if you set the total number of steps
to a high number. For example, if you're iterating over a large number of
items, consider setting the redraw frequency to a higher value by calling
:method:`Symfony\\Component\\Console\\Helper\\ProgressHelper::setRedrawFrequency`,
so it updates on only some iterations::

$progress->start($output, 50000);

// update every 100 iterations
$progress->setRedrawFrequency(100);

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

// advance every 100 iterations
if ($i % 100 == 0) {
$progress->advance();
}
}
$progress->advance();
}