Skip to content

Commit 3e26ca0

Browse files
committed
doc update
1 parent 7cfda06 commit 3e26ca0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
_Reference_: https://www.amazon.com/Modern-Java-Action-functional-programming/dp/1617293563
33

44
# project description
5-
1. We could get ask shop for a price of product (id)
5+
1. We could ask shop for a price of product (by id)
66
```
77
class Shop {
88
Price getPrice(int id) {
@@ -23,11 +23,12 @@ _Reference_: https://www.amazon.com/Modern-Java-Action-functional-programming/dp
2323
}
2424
}
2525
```
26-
1. we want to ask shop for many ids (for example stream of ids)
26+
1. we want to ask shop for many ids (for example
27+
we have a stream of ids)
2728
2829
# solution
29-
* naive approach -
30-
* one
30+
* **naive approach** - scales badly
31+
* one product
3132
```
3233
var priceFutures = IntStream.range(1, 2)
3334
.parallel()
@@ -41,7 +42,7 @@ _Reference_: https://www.amazon.com/Modern-Java-Action-functional-programming/dp
4142
.collect(toList());
4243
```
4344
**time: 203 ms**
44-
* four
45+
* four products
4546
```
4647
var priceFutures = IntStream.range(1, 4)
4748
.parallel()
@@ -55,7 +56,7 @@ _Reference_: https://www.amazon.com/Modern-Java-Action-functional-programming/dp
5556
.collect(toList());
5657
```
5758
**time: 203 ms**
58-
* scales badly
59+
* many products
5960
```
6061
var priceFutures = IntStream.range(1, 30)
6162
.parallel()
@@ -69,7 +70,7 @@ _Reference_: https://www.amazon.com/Modern-Java-Action-functional-programming/dp
6970
.collect(toList());
7071
```
7172
**time: 2 s**
72-
* dedicated executor - scales perfectly
73+
* **dedicated executor** - scales perfectly
7374
```
7475
var executor =
7576
Executors.newFixedThreadPool(Math.min(300, 100),
@@ -99,7 +100,7 @@ number of threads equal to the one returned by
99100
100101
So we decide to prepare dedicated executor for
101102
`CompletableFuture` tasks. How we estimated
102-
the number of possible threads in a pool?
103+
the number of threads in a fixed pool?
103104
From the given formula:
104105
105106
* `Nthreads = NCPU * UCPU * (1 + W/C)`

0 commit comments

Comments
 (0)