-
-
Notifications
You must be signed in to change notification settings - Fork 253
Closed
Labels
s: acceptedThis proposal was accepted. Someone can start working on it.This proposal was accepted. Someone can start working on it.
Milestone
Description
Description
I found that the afterFind method of *Model would create a log of goroutines via *errgroup.Group.Go(...) even if the element of the Value of *Model does not implement the AfterFindable interface, which might cause a lot of unneeded CPU cost. To avoid this, I think we could move the AfterFindable interface checking out of the Go function. If this's really a problem, I think I could submit a PR to fix it.
Lines 32 to 43 in 17f09c0
| for i := 0; i < rv.Len(); i++ { | |
| func(i int) { | |
| wg.Go(func() error { | |
| y := rv.Index(i) | |
| y = y.Addr() | |
| if x, ok := y.Interface().(AfterFindable); ok { | |
| return x.AfterFind(c) | |
| } | |
| return nil | |
| }) | |
| }(i) | |
| } |
Additional Information
No response
Metadata
Metadata
Assignees
Labels
s: acceptedThis proposal was accepted. Someone can start working on it.This proposal was accepted. Someone can start working on it.