[JW Lua] Slow JW Lua Scripts and Profiler

Charles O. Lawrence charlesolawrence at bellsouth.net
Wed Sep 3 16:10:04 CEST 2014


How about a simple example to demonstrate its use.  I tried this.  No
errors, but I can't find the report file anywhere.

		ProFi = require 'ProFi'
        		local it=0
		ProFi:start()
		for i=0,10000000 do it=it+i end
		ProFi:stop()
		ProFi:writeReport( 'MyProfilingReport.txt' )
        		print ('Sum',it)


Thanks,
Charles



-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Jari Williamsson
Sent: Wednesday, September 03, 2014 4:04 AM
To: The JW Lua script plug-in.
Subject: [JW Lua] Slow JW Lua Scripts and Profiler

Hello All!

For slow-running JW Lua scripts, I suggest using a profiler to see the lines
of code where it could be optimized.

I found a Lua profiler that works very well, called "ProFi". It's available
here:
https://gist.github.com/perky/2838755

Save the ProFi.lua script to your hard drive and add the path to the
"require" list in the JW Lua Preferences. Put the start() and stop() command
just around where the real processing of your script occurs.

Mac users: Please note that this will currently give inaccurate results on
the Mac, since Lua's os.time() function only return seconds on the Mac. I
hope to include a high resolution timer for both Windows and Mac in the next
beta. (ProFi supports custom timers through the
setGetTimeMethod() method.)


Best regards,

Jari Williamsson


_______________________________________________
JWLua mailing list
JWLua at jwmusic.nu
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu





More information about the JWLua mailing list