Page 3 of 3

Re: "profile.lua" a tool for finding bottlenecks

Posted: Wed Jul 18, 2018 4:15 pm
by Link
Thanks, very useful library, easier to use than others I found. I've added it to the list of Libraries in the Wiki: https://love2d.org/wiki/profile

Re: "profile.lua" a tool for finding bottlenecks

Posted: Tue Apr 30, 2019 4:51 pm
by Przemator
This profiling tool is fantastic. Thanks Ivan!

Would it be technically possible to make the profiling hierarchical? That is, if a function bar is called inside a function foo, it would be displayed as:

Code: Select all

Function   Calls   Time
/foo           1    5.0
/foo/bar       2    3.2
/foo/baz       1    1.5

Re: "profile.lua" a tool for finding bottlenecks

Posted: Tue Apr 30, 2019 7:11 pm
by ivan
Thanks Przemator.
It's certainly possible, but I'm not sure if it would be more useful.

Consider the following example:

Code: Select all

Function   Calls   Time
/foo           1    3.3
/foo/bar       2    3.2
/baz           1    1.6
/baz/bar       2    1.5
The "bar" function took 4.7 seconds of overall execution time but based on your suggestion
"bar" would be displayed as 2 different entries in the report ("foo/bar" and "baz/bar").

What if you have recursion with foo calling itself multiple times?

Code: Select all

foo
foo/foo
foo/foo/foo
Cheers!

Re: "profile.lua" a tool for finding bottlenecks

Posted: Tue Apr 30, 2019 7:22 pm
by Przemator
I work with Oracle, and the software I use generates really cool clickable SVG flame graphs.

Image

You're right, that it's useful to know the total elapsed time for a function, but it also helps to know which functions have been calling it. Don't know how the flame graph handles recurrence.

Re: "profile.lua" a tool for finding bottlenecks

Posted: Wed May 01, 2019 11:04 am
by Przemator
By the way, regarding the memory issue. The way it’s solved on the Oracle database I work with is following. First the profiling data is dumped into a file, which just keeps growing. It can easily get to 2 GB in just a few minutes. Then I supply this file into a report generator, which either creates a HTML report or a SVG graph.

Re: "profile.lua" a tool for finding bottlenecks

Posted: Wed May 01, 2019 11:15 am
by ivan
Looks cool, somebody already managed to hookup Lua with KCacheGrind so it's definitely possible to produce more sophisticated visualizations/reports. Personally, I don't really need that sort of thing for now, but you are free to modify the code, and use it any way you like. Cheers!

Re: "profile.lua" a tool for finding bottlenecks

Posted: Wed Oct 23, 2019 7:45 pm
by ivan
Found a few problems with the profiler under LuaJIT (JIT doesn't trigger the "return" event when recursion is involved).
I have just released a patch to account for that, but it's not perfect. Note that C-functions are not supported at all.
https://github.com/2dengine/profile.lua
Use at your own risk!

Re: "profile.lua" a tool for finding bottlenecks

Posted: Wed Oct 30, 2019 9:04 pm
by ivan
Just pushed a major update that verifies that the profiler works correctly with Love2D 11.3/LuaJIT 2.0.5 and Lua 5.3.
Please update your profile.lua if you are using this lib!