Add only missing persistent flags of parents in mergePersistentFlags
As persistent flags of parents can only be added, we don't need to always check them every time, so make updateParentsPflags return only added flags. Performance improvement: benchmark old ns/op new ns/op delta BenchmarkInheritedFlags-4 5595 4412 -21.14% BenchmarkLocalFlags-4 3235 2667 -17.56% benchmark old allocs new allocs delta BenchmarkInheritedFlags-4 39 24 -38.46% BenchmarkLocalFlags-4 21 15 -28.57% benchmark old bytes new bytes delta BenchmarkInheritedFlags-4 1000 600 -40.00% BenchmarkLocalFlags-4 544 408 -25.00%
This commit is contained in:
@ -675,7 +675,7 @@ func TestPersistentFlags(t *testing.T) {
|
||||
fullSetupTest("echo times -s again -c -p test here")
|
||||
|
||||
if strings.Join(tt, " ") != "test here" {
|
||||
t.Errorf("flags didn't leave proper args remaining..%s given", tt)
|
||||
t.Errorf("flags didn't leave proper args remaining. %s given", tt)
|
||||
}
|
||||
|
||||
if flags1 != "again" {
|
||||
|
Reference in New Issue
Block a user