On Saturday, 5 October 2019 at 02:59:58 UTC, Paul Backus wrote:
I was curious how C++17's std::variant compared to the options we have in D, like Algebraic and SumType, so I did a simple comparison of the generated assembly for each of them. You can read about it at the link below. And as you can probably guess from the title, D comes out ahead, in the end.

https://pbackus.github.io/blog/beating-stdvisit-without-really-trying.html

This is my first attempt at sharing something like this, so any comment or feedback is very much appreciated!

It'd be interesting if you could investigate the case of non-trivial lambdas, where inlining the lambdas is not profitable. Perhaps easiest if you call opaque (declaration-only) functions in the visit list.

Conclusion, performance-wise:
- SumType is great
- std::visit is OK'ish
- D Algebraic is terrible
Do you agree?

cheers,
  Johan

              • ... Joseph Rushton Wakeling via Digitalmars-d-announce
              • ... Andrei Alexandrescu via Digitalmars-d-announce
              • ... Paul Backus via Digitalmars-d-announce
              • ... Joseph Rushton Wakeling via Digitalmars-d-announce
              • ... Paul Backus via Digitalmars-d-announce
          • Re: Bl... Arredondo via Digitalmars-d-announce
        • Re: Blog P... Paolo Invernizzi via Digitalmars-d-announce
          • Re: Bl... Walter Bright via Digitalmars-d-announce
            • R... Paolo Invernizzi via Digitalmars-d-announce
            • R... Andrej Mitrovic via Digitalmars-d-announce
  • Re: Blog Post: Beating ... Johan Engelen via Digitalmars-d-announce
  • Re: Blog Post: Beating ... user1234 via Digitalmars-d-announce
  • Re: Blog Post: Beating ... Mike Parker via Digitalmars-d-announce

Reply via email to