|Posted by H. S. Teoh|
in reply to seany
On Tue, Jun 08, 2021 at 05:10:47PM +0000, seany via Digitalmars-d-learn wrote: [...]
> Profiling doesn't help, because different input is causing different parts of the program to become slow.
Do you have any more specific information about what kind of inputs cause which parts of the program to slow down? Without more details it's hard to say what the problem is.
But I'd say, if you care about performance you should fix *all* of the slow parts that your profiler finds.
There are some performance best practices that you should follow, such as reduce frequent GC allocations, avoid expensive algorithms (like O(n^2) or worse) where possible, avoid excessive copying of data, perform I/O in larger blocks instead of small bits at a time, avoid excessive indirection (final methods where they don't need to be virtual, by-value types instead of deep dereferencing, etc.), cache frequently-computed results, etc..
But more importantly, if you can elaborate a bit more on what your program is trying to do, it would help us give more specific recommendations. There may be domain-specific optimizations that you could apply as well.
MS Windows: 64-bit rehash of 32-bit extensions and a graphical shell for a 16-bit patch to an 8-bit operating system originally coded for a 4-bit microprocessor, written by a 2-bit company that can't stand 1-bit of competition.