Skip to content

Commit fff7783

Browse files
authored
Merge pull request pazams#13 from pazams/improve-concurrency-and-parallelism
Cleanup
2 parents eda80f1 + 83febb0 commit fff7783

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
- [(S) Garbage Collection](#s-garbage-collection)
1717
- [(D) Compilation](#d-compilation)
1818
- [Concurrency & Parallelism](#concurrency--parallelism)
19-
- [Overview (D)](#overview-d)
20-
- [Async vs Sync APIs (D)](#async-vs-sync-apis-d)
21-
- [Sequential and Concurrent Patterns (D)](#sequential-and-concurrent-patterns-d)
19+
- [(D) Overview](#d-overview)
20+
- [(D) Async vs Sync APIs](#d-async-vs-sync-apis)
21+
- [(D) Sequential and Concurrent Patterns](#d-sequential-and-concurrent-patterns)
2222
- [Modules / Packages](#modules--packages)
2323
- [Spec & Practice](#spec--practice)
2424
- [Management](#management)
@@ -105,7 +105,7 @@ Go is compiled. Javascript is not, though some Javascript runtimes use JIT compi
105105

106106
# Concurrency & Parallelism
107107

108-
## Overview (D)
108+
## (D) Overview
109109

110110
**JS**
111111

@@ -126,7 +126,7 @@ More on this subject:
126126
- [Advanced Go Concurrency Patterns](https://talks.golang.org/2013/advconc.slide#1)
127127

128128

129-
## Async vs Sync APIs (D)
129+
## (D) Async vs Sync APIs
130130
**JS**
131131

132132
JS promotes writing async APIs, since sync APIs always block the caller, e.g:
@@ -155,21 +155,21 @@ func fetchA() fetchResult {
155155
return fetchResult{"A data", nil}
156156
}
157157
```
158-
If the caller wants to be blocked, then he can just the function
158+
If the caller wants to be blocked, then he can just call the function
159159
```Go
160160
a := fetchA()
161161
```
162-
If the caller does not want to be blocked, then he could run the function inside a goroutine:
162+
If the caller does not want to be blocked, then he could call the function inside a goroutine:
163163
```Go
164164
aChan := make(chan fetchResult, 0)
165165
go func(c chan fetchResult) {
166166
c <- fetchA()
167167
}(aChan)
168168
```
169169

170-
## Sequential and Concurrent Patterns (D)
170+
## (D) Sequential and Concurrent Patterns
171171

172-
**Go**
172+
**JS**
173173

174174
Even without parallelism, we can structure Javascript code in both sequential and concurrent flows.
175175
For the following exmaples, let’s assume `fetchA()`, `fetchB()` and `fetchC()` are all async functions returning a promise.

0 commit comments

Comments
 (0)