mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
Updated CompilerOptimizations (markdown)
parent
81df82376e
commit
39df6aca67
@ -1,4 +1,4 @@
|
||||
# Compiler Optimizations
|
||||
# Compiler And Runtime Optimizations
|
||||
|
||||
This page lists optimizations done by the compilers. Note that these are not guaranteed by the language specification.
|
||||
|
||||
@ -78,3 +78,20 @@ are converted into efficient runtime memclr calls. [Issue](golang.org/issue/5373
|
||||
|
||||
* **gc:** 1.5+
|
||||
* **gccgo:** ?
|
||||
|
||||
## Non-scannable objects
|
||||
|
||||
Garbage collector does not scan underlying buffers of slices, channels and maps when element type does not contain pointers (both key and value for maps). This allows to hold large data sets in memory without paying high price during garbage collector. For example the following map won't visibly affect GC time:
|
||||
|
||||
```go
|
||||
type Key [64]byte // SHA-512 hash
|
||||
type Value struct {
|
||||
Name [32]byte
|
||||
Balance uint64
|
||||
Timestamp int64
|
||||
}
|
||||
m := make(map[Key]Value, 1e8)
|
||||
```
|
||||
|
||||
* **gc:** 1.5+
|
||||
* **gccgo:** ?
|
Loading…
x
Reference in New Issue
Block a user