Skip to content

Commit 0038a97

Browse files
Review progress bar
1 parent 0e2fc94 commit 0038a97

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

General/ProgressBar.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
# Progress bar
22

3-
This document will cover different ways in Pharo to display a progress bar when executing code.
3+
This document covers different ways to display a progress bar during code execution.
44

55
## Progress bar on iterators
66

7-
The easiest way to create a progress bar is to use the method `do:displayingProgress:`. This method is present on Collections and will add a progress bar updating during the iteration.
7+
The easiest way to create a progress bar is to use the method `do:displayingProgress:`. This method is available on Collections and adds a progress bar automatically updated during iterations.
88

99
```Smalltalk
1010
(1 to: 100) do: [ :each | each logCr. 100 milliSecond wait. ] displayingProgress: [ :each | 'Iterating step ' , each asString ]
1111
```
1212

13-
You can also customize the refresh time if you want better performances:
13+
Refresh time can also be customized if better performances are needed. For example, the following code will update the progress bar every 2 seconds:
1414

1515
```Smalltalk
1616
(1 to: 100) do: [ :each | each logCr. 100 milliSecond wait. ] displayingProgress: [ :each | 'Iterating step ' , each asString ] every: 2000
1717
```
1818

19-
This code will update the progress bar every 2 seconds.
20-
2119
## Use Jobs
2220

2321
An other way to display a progress bar is to use Jobs.
@@ -48,9 +46,9 @@ UIManager default
4846
] ]
4947
```
5048

51-
While using this method be careful of performances when you have a lot a really fast steps.
49+
Be careful while using this method. It might cause performance issues when time between two steps is short.
5250

53-
Here is a way to manage this:
51+
However, the following code shows a way to avoid these issues.
5452

5553
```Smalltalk
5654
UIManager default
@@ -70,4 +68,4 @@ UIManager default
7068
] ]
7169
```
7270

73-
This will update the progress bar every 500 milliseconds instead of updating the bar each time we call #value: or #title:
71+
The trick is to leave at least 500 milliseconds between two updates instead of updating the bar each time we call `value:` or `title:`.

0 commit comments

Comments
 (0)