On Friday, 15 January 2021 at 07:35:00 UTC, H. S. Teoh wrote:
(1) Refactored one function called from an inner loop to reuse a buffer instead of allocating a new one each time, thus eliminating a large amount of garbage from small allocations;
<...>
The result was about 40-50% reduction in runtime, which is close to about a 2x speedup.

I think this message needs to be signal boosted. Most of the time GC is not the problem. The problem is sloppy memory usage. If you allocate a lot of temporary objects your performance will suffer even if you use malloc and free. If you write code that tries to use stack allocation as much as possible, doesn't copy data around, reuses buffers then it will be faster than manual memory management that doesn't do that. And thats with a "slow" GC.
              • ... James Blachly via Digitalmars-d-learn
              • ... Ola Fosheim Grostad via Digitalmars-d-learn
              • ... aberba via Digitalmars-d-learn
              • ... Ola Fosheim Grøstad via Digitalmars-d-learn
              • ... aberba via Digitalmars-d-learn
              • ... H. S. Teoh via Digitalmars-d-learn
              • ... Ola Fosheim Grøstad via Digitalmars-d-learn
              • ... Guillaume Piolat via Digitalmars-d-learn
              • ... Ola Fosheim Grøstad via Digitalmars-d-learn
        • Re: Why m... Ola Fosheim Grøstad via Digitalmars-d-learn
        • Re: Why m... welkam via Digitalmars-d-learn
          • Re: W... H. S. Teoh via Digitalmars-d-learn
          • Re: W... Max Haughton via Digitalmars-d-learn
            • ... Ola Fosheim Grøstad via Digitalmars-d-learn
          • Re: W... Imperatorn via Digitalmars-d-learn
  • Re: Why many programme... Виталий Фадеев via Digitalmars-d-learn
  • Re: Why many programme... welkam via Digitalmars-d-learn

Reply via email to