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

Async events improve #85

Closed
wants to merge 3 commits into from
Closed

Async events improve #85

wants to merge 3 commits into from

Conversation

ramon-bernardo
Copy link

@ramon-bernardo ramon-bernardo commented Feb 28, 2024

Melhorias

  • Prefira crossbeam-channel ao invés de std mpsc.
  • Renomeia EventSender para AsyncEventSender e EventReceiver para AsyncEventReceiver.
  • Adiciona AsyncEventSet, possibilitando ordenar os sistemas.
  • Renomeia channel_to_event para unbounded_channel_to_event.
  • Prefira executar o mapeamento entre mensagem do canal para evento no Scheduler PreUpdate ao invés de Update.

Meu analyzer ta bugado com os 600 pacotes do projeto, além dos arquivos proto, pode ser que precise de algum polimento no código, além da doc do SystemSet.

@@ -16,6 +16,7 @@ readme = "../README.md"
async-std = "1.12.0"
derive_more = "0.99.17"
serde_repr = "0.1"
crossbeam-channel = "0.5.12"
Copy link
Author

Choose a reason for hiding this comment

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

Se preferir, posso mudar para o workspace.

@lgrossi
Copy link
Collaborator

lgrossi commented Feb 29, 2024

Hi, thank you for collaborating! Can you summarize the main differences between crossbeam and mpsc?
It's the first time I'm seeing crossbeam, so I'm curious about the trade offs.

@ramon-bernardo
Copy link
Author

ramon-bernardo commented Feb 29, 2024

Até um tempo atrás, crossbeam-channel e std::sync::mpsc tinham uma grande diferença de desempenho. Pesquisando um pouco mais, parece que foi mesclado o código do crossbeam-channel no mpsc std, no entanto, as melhorias e correções sempre chegam mais cedo em crossbeam-channel do que em std. Por exemplo, esta correção ainda sairá em rust 1.78.0, e já foi corrigido no crossbeam-channel.

O uso de crossbeam-channel também nos da a possibilidade de usar: try_send, send_timeout, send_deadline, is_empty, is_full, len, capacity, same_channel no AsyncEventSender.

@luan
Copy link
Collaborator

luan commented Mar 1, 2024

Hi @ramon-bernardo,

Thanks for the effort you put in here and for presenting us with the crossbeam option. At this time, I don't see a compelling reason to add an external dependency when the standard library is doing a good enough job and we're not seeing any performance issues. We also don't need multi-consumer so that's another reason why sticking with mpsc is the current choice.

Another piece of feedback: please try to stick to English in public communications here on Github. This project is open source because we want to make it as inclusive as possible, and English is the language that enables the most amount of people to understand us here.

Once again, thank you for putting this work in, but at the time we're not going to take it.

@luan luan closed this Mar 1, 2024
@ramon-bernardo ramon-bernardo deleted the async-event-improve branch March 1, 2024 23:47
@ramon-bernardo
Copy link
Author

@luan, os benchmarks atuais do crossbeam-channel estão desatualizados, procurando um mais recente, percebe-se uma melhoria de até 40% em SPSC e 80% em MPSC.
image

@lgrossi
Copy link
Collaborator

lgrossi commented Mar 8, 2024

@luan, os benchmarks atuais do crossbeam-channel estão desatualizados, procurando um mais recente, percebe-se uma melhoria de até 40% em SPSC e 80% em MPSC.
image

As explained above, please stick to english. We will no longer reply messages that are not in english. Thank you again for your time and for contributing.

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