Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race fix #2

Merged
merged 11 commits into from
Jul 23, 2024
Merged

Race fix #2

merged 11 commits into from
Jul 23, 2024

Conversation

Vypolor
Copy link
Contributor

@Vypolor Vypolor commented Jul 17, 2024

No description provided.

run_loop.go Outdated Show resolved Hide resolved
run_loop.go Outdated
@@ -115,6 +118,14 @@ func (s *runLoop) run() {
if msg == nil {
continue
}
valMsg := reflect.ValueOf(msg)
if valMsg.Kind() == reflect.Pointer {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Чекать тип намного дешевле значения, там всё сводится к нескольким простым операциям на unsafe.Pointer reflect.TypeOf(msg).Kind() == reflect.Pointer

}
for i := range inputs {
input := inputs[i]
for j := range input.outputPipelines {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Минор, но я бы избавился от i/j в пользу итерация по инпутам for _, inpit := range inpits {} ради читаемости, мы эту штуку запускаем всего один раз при запуске, и на лишние копирования в принципе можем забить с чистой совестью)

@Vypolor Vypolor merged commit b777664 into main Jul 23, 2024
2 checks passed
@Vypolor Vypolor deleted the race_fix branch July 23, 2024 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants