Profile Code

What does profile code do in the build settings? I cant find anything on it in the LR. I have switched it on and built but it hasn’t given me the output text file.

Profiling code gives you calculations on how your application performed: The number of times a method was called, the average amount of time (in milliseconds) for each call, etc…

The profiler is not part of the Xojo language so you would not use the Language Reference to look up the profiler. Instead look at the Users Guide, specifically “UserGujide-Framework.pdf” starting on page 187. If you are at all new to Xojo it is highly recommended to read the User Guide pdfs. Even if you aren’t, due to the change from RealBasic to Xojo it is not a bad idea to read through them since things are different now.

Thank you very much. I will take a look at the PDFs

Thanks Harrie - The profiler is very useful. I am knocking so much time off my processor intensive tasks using the profiler. Fantastic, just what I was after.

Anyone else who has not used the profiler and need to optimise your applications I would advise giving it a go.

Just remember:

Don’t worry about optimization until a portion of code shows it is a problem.

It was beginning to be a bit sluggish. I am at testing stage so hit my app with masses of data and it was showing serious signs of sluggishness. I agree though I wouldn’t have bothered should the problems not have shown.

Is there a way to profile only PART of the program?
if I turn on Profiler in the IDE, it take my app forever to even start… and at the moment I really don’t want/or care about any stats up until the app is initialized, and I click a particular button… then I want from that event until I shut down the app.

Normally the app initialzes in a few seconds… I’ve been waiting 10 minutes already… that kinda kills productivity

No.

That said, I’m a little surprised at your startup time. Even the IDE doesn’t take that long with profiling turned on.

I’d be curious if the profiler revealed some inherent inefficiency in your startup routine, like one method being called a million times or something like that.

I gave up waiting after 20 minutes… Turned the Profiler off… and the same steps intiailized in about 15 seconds

I use the profiler quite often, not specific for timing only, but for checking the sequence and frequency of calls. But therefore I would like to have a NATIVE option in the IDE to export the profiler output quickly to Excel for example. Since the amount of data can be huge, and you want to find just specific parts, like @Dave S said, that can easily be done with other tools like Excel.

In this case, build your app with profiling turned on. Launch your app, use it for a while and after a clean quit, a file will be created next to your app named Profile.txt which contains the profiling info.

You can then use this to display the data in that file similar to how Xojo does.

https://github.com/ktekinay/Profile-Reader

Thanks Greg. Forgot about this option.

[quote=338696:@Kem Tekinay]You can then use this to display the data in that file similar to how Xojo does.
https://github.com/ktekinay/Profile-Reader [/quote]
Oh… thanks Kem, I had your tool already on my disk, but totally forgot about it. I will definitely start using it.