{"push_id":3468451550,"size":2,"distinct_size":2,"ref":"refs/heads/allocate-byte","head":"bf4d70fca4389f1695fe69db9652d0791b0ddda8","before":"149db2bf9cea7885d60d2e38e1953c69937992e2","commits":[{"sha":"94a3f20543055becdcdf15e2dca0a8b111b6cdfb","author":{"name":"Max Leonard Inden","email":"bb17a4a5e30bc4dd6ff6d9ba25e3b87c5052b918@gmail.com"},"message":"internal/collector: Preallocate metric slice length when known upfront\n\nProfiling kube-state-metrics shows that a lot of CPU time is spent on\n`runtime.growslice`. This is related to metric generation when\nconverting a Kuberntes object to a slice of metrics in\n`metric.FamilyGenerator`s. Oftentimes the length of the metric slice is\nknown upfront.\n\nWhen the needed size of the metrics slice is known upfront, allocate an\nappropriately sized metric slice.","distinct":true,"url":"https://api.github.com/repos/mxinden/kube-state-metrics/commits/94a3f20543055becdcdf15e2dca0a8b111b6cdfb"},{"sha":"bf4d70fca4389f1695fe69db9652d0791b0ddda8","author":{"name":"Max Leonard Inden","email":"bb17a4a5e30bc4dd6ff6d9ba25e3b87c5052b918@gmail.com"},"message":"pkg/metrics_store: Cache byte slices instead of strings\n\nWhen converting a string to a byte slice, in Golang would do a full copy\nwhich introduces memory allocations. On an HTTP scrape request WriteAll\nin the metrics store component is called, which writes all cached\nmetrics into the given io.Writer. io.Writer takes a byte slice, whereas\nmetrics are cached as strings. The connect the two, the metrics store\ncomponent converts the metric strings to byte slices. This results in\n`runtime.stringtoslicebyte` [1] being a prominent CPU user.\n\nInstead of caching metrics as strings, cache them as byte slices,\nremoving the additional translation from the hot-path.\n\n[1] https://golang.org/src/runtime/string.go?s=4063:4115#L145","distinct":true,"url":"https://api.github.com/repos/mxinden/kube-state-metrics/commits/bf4d70fca4389f1695fe69db9652d0791b0ddda8"}]}
{"actor":{"display_login":"mxinden"}}