Skip to content

Commit 015f546

Browse files
committed
update md files
1 parent e501823 commit 015f546

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,12 @@ running all performance testing benchmarks
3030
### Usage
3131
Please refer to [example](example)
3232

33-
## Versioning
34-
- 0.1
35-
- Initial Release
36-
37-
## Roadmap
38-
- [x] support more waiting strategies
39-
- [ ] support publish N messages
40-
- [ ] support consume N messages
41-
- [ ] support proper DSL
42-
- [ ] more examples
33+
## Plan
34+
- [ ] Sequence
35+
- [ ] Waiting Strategy
36+
- [ ] Sequence Barrier
37+
- [ ] Sequencer
38+
- [ ] RingBuffer
4339

4440
## License
4541
Distributed under the MIT License. See [LICENSE.txt](LICENSE.txt) for more information.

internal/sequence.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
## Sequence
2-
Sequence is the fundemtal data strcture for the entire package.
2+
Sequence is the fundamental data structure for the entire package.
33

4-
In short, sequence is just a thread-safe counter, which for the consumer and producer to wait, get then process
5-
a slot from the ring buffer. Refer to Sequencer for more details.
4+
In short, sequence is just a thread-safe counter, points to a slot in the ring buffer.
5+
The consumer and producer uses a wait strategy to wait for the number.
6+
Once get the slot, then the consumer or producer can continue its process.
67

78
Following Sequences are tested
89
* struct with int64
@@ -13,22 +14,26 @@ All performance testing are done in Windows 10 with i5-11400F @ 2.60GHz in conso
1314
```powershell
1415
#bechmark
1516
go test -benchmem -run=^$ -tags -race -bench ^BenchmarkSequenceGet$ goDisruptor/internal
17+
1618
#profile
1719
go test -cpuprofile cpu.prof -memprofile mem.prof -benchmem -run=^$ -tags -race -bench ^BenchmarkSequenceGet$ goDisruptor/internal
20+
1821
#get top function calls
1922
go tool pprof cpu.prof => top
23+
2024
# generate call graph
2125
go tool pprof cpu.prof => png
26+
2227
# get top memory allocation
2328
go tool pprof mem.prof => top
2429
```
2530

2631
### Performance results
27-
||Get without GC|Get with GC|Set without GC|Set with GC|Concurrent Get and Set without GC
28-
| -- | -- | -- | -- | -- | -- |
29-
|struct int64|10.18 ns/op|11.42 ns/op|4.624 ns/op|4.615 ns/op|21.70 ns/op|
30-
|struct [8]int64|23.10 ns/op|36.69 ns/op|4.714 ns/op|5.033 ns/op|49.09 ns/op|
31-
|int64|0.2708 ns/op|0.2416 ns/op|4.936 ns/op|5.150 ns/op|5.291 ns/op|
32+
| | Get without GC | Get with GC | Set without GC | Set with GC | Concurrent Get and Set without GC |
33+
|-----------------|----------------|--------------|----------------|-------------|-----------------------------------|
34+
| struct int64 | 10.18 ns/op | 11.42 ns/op | 4.624 ns/op | 4.615 ns/op | 21.70 ns/op |
35+
| struct [8]int64 | 23.10 ns/op | 36.69 ns/op | 4.714 ns/op | 5.033 ns/op | 49.09 ns/op |
36+
| int64 | 0.2708 ns/op | 0.2416 ns/op | 4.936 ns/op | 5.150 ns/op | 5.291 ns/op |
3237

3338

3439
### Get vs. Set
@@ -38,8 +43,8 @@ go tool pprof mem.prof => top
3843
// no significant difference in call graph, likely due to the I/O, lock, Timer, scheduling etc.
3944

4045
### Impact of malloc
41-
** mallocgc allocates 8 bytes cost around 8ns, compare to 20ns for 64 bytes
42-
** atomic.StoreInt64 doesn't call mallocgc, it is consistent 4ns
46+
** malloc allocates 8 bytes cost around 8ns, compare to 20ns for 64 bytes
47+
** atomic.StoreInt64 doesn't call malloc, it is consistent 4ns
4348
** implementation using int64 directly, no allocation to heap, 0.2 ns only
4449

4550
### Impact of the struct

0 commit comments

Comments
 (0)