Good afternoon, esteemed community of Pascal lovers!
I am a beginner amateur developer.
I would like to introduce you some two tools I made for performance analysis.
The first one is a memory profiler.
https://github.com/Alligator-1/callstack_memprofilerWith its help you can find not quite optimal places in your project that can be improved, unnecessary or non-obvious memory allocations.
This tool should be cross-platform, but I work on Windows and haven't tested it on Linux, I haven't had time for it yet...
The next tool is a CPU profiler. Unfortunately at the moment it can work only with Windows x64, due to the presence of asm-inserts, porting to Linux x64 is in the plans, but again everything is related to free time.... but I welcome forks, I'm not sure about patches and merge requests yet, but forks are welcome.
Also, it also requires FPC to be patched to make it work.
https://github.com/Alligator-1/cpuprofilerWith this tool as well as with the previous one you can evaluate bottlenecks in the code and maybe find ideas for further optimizations!
Here is a short instruction on how to use CPUProfiler:
- You need to patch FPC and rebuild it
- Then plug profiler_proxy.pas into your project.
- Then somewhere at the beginning of your project call profiler_proxy.profiler_init
- and at the end of the program call profiler_proxy.profiler_reset.
- Set the environment variable profiler=1
- Enable generation of debugging information in the project
- Start compilation of your project via CleanUp & Build
- Run your project, work in it and then terminate it
- The file “datetime.cpuprof” will appear next to the project executable file
- Open it in cpuprofilerviewer, and also in cpuprofilerviewer load the executable itself (to see the symbolic names)
If you have any questions - you can ask here on the forum or on github, I will try to answer them )
Keep in mind, I'm just a beginner, so my code may seem suboptimal or confusing to you ) but I'm open to discussion and always looking for more optimal implementations
I hope you find these tools useful! They have already helped me, let them help you too! )
PS: Sorry, I can't figure out how to insert images into a post, but the links have screenshots, if someone could insert them into the posts below that would be great