Menu

How to use profiling to speed up p5c pascal programs

The idea behing profiling is to identify so called hot-spots in your program - ie those parts where the program spends most of its time.
When we know where they are, we can rework the code to make it run faster.
There's no point doubling the speed of code that runs 1% of the time because it won't be noticed. On the other hand, doubling the speed of code that runs, say, 20% of the time should save 10% on your program's execution time.

Here, we'll be looking to make p5c run faster. I'm running on linux,and will be using the profiliemodule of valgrind to collect the profing data, and kcachegrind to examine it. You can adapt the techniques here to your own setup.

step 1 - build a debug version of the program under test

This puts the line numbers and symbol names in the compiled program and enables the results to be displayed in terms of program line numbers and function names (or procedure names).

Our prgram under test is p5c so to remove some confusion, we'll call our debug version p5cd.

To be continued ...

Posted by Trevor Blight 2017-07-26 | Draft

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.