mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-12-01 22:52:01 +02:00
Store Pipe objects by value in slice of Pipes
This saves some memory at the cost of a slight performance increase (I suppose reallocting the slice when adding new Pipes is slightly more expensive now). Performance of the BenchmarkRenderCommitGraph benchmark is 130μs before, 175μs after. I'm guessing this is still acceptable.
This commit is contained in:
@@ -28,7 +28,7 @@ type pipeSetCacheKey struct {
|
||||
}
|
||||
|
||||
var (
|
||||
pipeSetCache = make(map[pipeSetCacheKey][][]*graph.Pipe)
|
||||
pipeSetCache = make(map[pipeSetCacheKey][][]graph.Pipe)
|
||||
mutex deadlock.Mutex
|
||||
)
|
||||
|
||||
@@ -245,7 +245,7 @@ func indexOfFirstNonTODOCommit(commits []*models.Commit) int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func loadPipesets(commits []*models.Commit) [][]*graph.Pipe {
|
||||
func loadPipesets(commits []*models.Commit) [][]graph.Pipe {
|
||||
// given that our cache key is a commit hash and a commit count, it's very important that we don't actually try to render pipes
|
||||
// when dealing with things like filtered commits.
|
||||
cacheKey := pipeSetCacheKey{
|
||||
|
||||
Reference in New Issue
Block a user