Repository navigation
[CI]: rewrite compose test - #4359
Conversation
2db7f76 to
9b566d7
Compare
9b566d7 to
46e50ee
Compare
|
Rebased on principles. |
|
Unrelated failures: |
| helpers.Ensure("compose", "-f", data.Temp().Path("project-1", "compose.yaml"), "up", "-d") | ||
| helpers.Ensure("compose", "-f", data.Temp().Path("project-2", "compose.yaml"), "up", "-d") | ||
| helpers.Ensure("compose", "-f", data.Temp().Path("project-2", "compose.yaml"), "down", "-v") | ||
| helpers.Ensure("compose", "-f", data.Temp().Path("project-2", "compose.yaml"), "up", "-d") |
There was a problem hiding this comment.
Why call data.Temp() multiple times?
There was a problem hiding this comment.
data.Temp() is just an accessor.
Alternatively we could hold a ref to the returned value, but that would probably be exactly the same thing as the compiler should inline the function call.
Anyhow, if you prefer it changed to call once and keep a ref on it for readability, that is fine with me of course, so, just lmk.
There was a problem hiding this comment.
Note: I have always been curious what the compared cost of a function call versus having variables moved to the heap (I assume the later is much more costly).
(sometimes I wish I would know more about how a compiler works...)
There was a problem hiding this comment.
Not sure if the compiler is smart enough to detect that Temp() is idempotent and safe to inlinize it.
I'd still prefer this to be called just once, but no strong opinion.
There was a problem hiding this comment.
Interesting conversation.
The compiler will inline this (which is the pattern used here):
package main
type Bar struct {
}
type Foo struct {
pv *Bar
}
func (f *Foo) PV() *Bar {
return f.pv
}
func New() *Foo {
return &Foo{pv: &Bar{}}
}
func main() {
f := New()
f.PV()
f.PV()
f.PV()
}./main.go:20:6: inlining call to (*Foo).PV
./main.go:21:6: inlining call to (*Foo).PV
./main.go:22:6: inlining call to (*Foo).PV
Whether this happens in the context of tests is an open question though.
I'd still prefer this to be called just once, but no strong opinion.
Sure.
Let me do it now.
There was a problem hiding this comment.
Latest push has the change ^.
46e50ee to
854bc39
Compare
|
Rebased. |
Signed-off-by: apostasie <[email protected]>
854bc39 to
53e69a3
Compare
Tentatively fix #4146