I am working on a heuristic search project and once I got a working example, I started to benchmark it just to discover that it was not fast enough. I started profiling it (not really an expert on how to do that for a project either) and discovered that it spends 80% of the time in garbage collection.
I tried to find on the internet how to reduce this time, but I have not been able to find something general. Can someone recommend some literature on the topic, or give some general guidelines on how garbage collection works? How should I try to look for the problem and what can be causing it?
Edit: I'm not talking that much about tools to profile the code, for which it's true that Krom's suggested question is on point Rather than that I'm looking for general tips and practices to make (specifically) garbage collection take less time, since the abstractions in the language make it harder to think about what can be going on exactly. Is there something like that?