my face
About Me

Published Posts

All Posts

New Post


View by Tag:

interviewing, code, testing, philosophy, blog, wantmyjob, virtualization, railsmud, heroku, ruby, published, neoarchaeology, railsgame, rails, juggernaut, astrino, cheaptoad, shannaspizza, mongodb, refactorit, devise, rvm, passenger, jruby, programming, vagrant, chef, railsframe, business, codefolio


Online Portfolio

Resume

Profile on LinkedIn

Recommend me on WorkingWithRails: Recommend Me

Profiling idea

Posted: 5 months ago (2011-09-11 21:08:13 UTC )

Standard profiling takes one of two approaches (usually).

1. Sampling - an independent interrupt, loop, timer, etc runs separately and periodically checks the status of the program being profiled. This has lower precision in many cases since it can miss even fairly common events in certain cases. But the information being gathered is good - the program's actual performance characteristics are barely changed at all.

2. Instrumentation - the program is changed to record times regularly, often at method boundaries or "line of code"-type boundaries. This gives much better precision since you'll know absolutely every time a given line/method is executed. But it takes time to record these times, so the perfectly-gathered information is on a program with subtly different performance.

You know what would be a really good idea in certain cases? Compile two different versions of a given line/method/unit and call the instrumented one some percentage of the time, say 1%. Then you're barely changing the program's performance in most cases, so functions where most of the time is spent in sub-functions will be measured far more accurately.

That's not terribly different from the standard practice of "manually" profiling just what you're interested in and not modifying any other functions. But this would get pretty close to that level of accuracy for the whole program at once, which would be neat.

This assumes that the bit of code to choose which version to execute doesn't take much time, of course, which may or may not be a reasonable assumption.

Previous: Jab: codefolio / Next: Commando in Code

Edit | Destroy | See All Posts

blog comments powered by Disqus