Skip to content
New issue

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

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

Already on GitHub? # to your account

Reduce allocation rate #3552

Closed
fwbrasil opened this issue Feb 29, 2024 · 2 comments
Closed

Reduce allocation rate #3552

fwbrasil opened this issue Feb 29, 2024 · 2 comments

Comments

@fwbrasil
Copy link
Contributor

Tapir version: 1.8.4

Scala version: 3.3.1

Describe the bug

I'm using Tapir to join a performance benchmark challenge with Kyo. The implementation is highly optimized so Tapir's object allocation overhead became the main bottleneck. This is likely relevant only for high-throughput and very lightweight endpoints but reducing the allocation rate would help better position Tapir and kyo-tapir in similar benchmarks.

How to reproduce?

Clone https://github.com/fwbrasil/rinha-2024-q1 and https://github.com/zanfranceschi/rinha-de-backend-2024-q1. Run ./run.sh and then ./executar-teste-local.sh on the respective repositories.

Additional information

  • I'm planning to submit multiple PRs to the different repositories that Tapir uses and link them to this ticket.
  • The challenge deadline is March 10, so it would be great if there are artifacts with the optimizations by then but I can also publish snapshots locally instead.
  • I'm planning to move fast without microbenchmarks for validation but let me know if you'd prefer a more structured approach. I can try introducing JMH benchmarks for the changes.
@adamw
Copy link
Member

adamw commented Feb 29, 2024

Thanks! Looks promising :)

I don't think microbenchmarks would be necessary, they wouldn't likely spot regressions - which would appear in new places. @kciesielski is currently working on a testsuite which we could run periodically to verify if performance hasn't degraded - so while its general resolution might not be as high, I think it should be enough for now to ensure that we aren't dramatically worse in performance.

As for the changes, we'll mostly review / merge / release from Monday, as tomorrow we're out of office until Sunday.

@fwbrasil
Copy link
Contributor Author

fwbrasil commented Mar 7, 2024

Thank you so much for the quick reviews and the release with the changes! I think I benefited of other optimizations in the latest release as well and I'm happy with the performance of Tapir in my benchmark now :) I'm closing this issue since I'm not planning to work on more allocation-related optimizations for now.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants