profile.lua is a real-time, non-intrusive tool for finding bottlenecks in your game. You don't have to modify any of your existing code to use this tool. You require the profiler and tell it when to start/stop collecting data. It's good to reset the profiler every 100 frames so you can look for bottlenecks in real-time.

Documentation and sourcecode