Skip to content

Commit 0264057

Browse files
authored
Update README.md
1 parent bc9403e commit 0264057

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212

1313
> x/sync/singleflight but better
1414
15-
## Features
15+
## Features
1616

1717
This library is inspired by `x/sync/singleflight` but adds many features:
1818
- 🧬 generics: type-safe API, no `interface{}` boxing overhead
1919
- 🍱 batching: fetch multiple keys in a single callback, with in-flight deduplication
2020
- 📭 nullable result
2121
- 🍕 sharded groups
2222

23-
## Performance
23+
### Performance
2424

2525
`x/sync/singleflight` uses `any` (aka `interface{}`) for return values, which means every value must be boxed into an interface on write and type-asserted on read. For value types (structs, ints, etc.), boxing triggers a heap allocation and increases GC pressure — an unnecessary cost in high-throughput or high-concurrency paths.
2626

@@ -38,7 +38,7 @@ This library is v0 and follows SemVer strictly. No breaking changes will be made
3838

3939
GoDoc: [https://pkg.go.dev/github.com/samber/go-singleflightx](https://pkg.go.dev/github.com/samber/go-singleflightx)
4040

41-
## Examples
41+
## 🔥 Examples
4242

4343
Here is an example of a user retrieval in a caching layer:
4444

0 commit comments

Comments
 (0)