# Building a deterministic profiler for mixed C and Perl code

DevFeed: [Building a deterministic profiler for mixed C and Perl code](<https://devfeed.tech/articles/getting-carried-away-with-hack-value-21904.md>)

Original publisher: [Read original article](<https://blog.nelhage.com/2010/05/hack-value/>)

Author: Nelson Elhage

Published: 2010-05-23T19:53:30Z

Content type: opinion

Language: en

Sources: [Nelson Elhage](<https://devfeed.tech/sources/nelson-elhage.md>)

Topics: [Perl](<https://devfeed.tech/topics/perl.md>), [C](<https://devfeed.tech/topics/c.md>), [debug](<https://devfeed.tech/topics/debug.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [debug](<https://devfeed.tech/tags/debug.md>), [function](<https://devfeed.tech/tags/function.md>), [gcc](<https://devfeed.tech/tags/gcc.md>), [glibc](<https://devfeed.tech/tags/glibc.md>), [memory](<https://devfeed.tech/tags/memory.md>), [perl](<https://devfeed.tech/tags/perl.md>), [profiling](<https://devfeed.tech/tags/profiling.md>), [tools](<https://devfeed.tech/tags/tools.md>)

## AI overview

The author describes trying to improve profiling visibility in BarnOwl, a program that mixes C and Perl. Statistical profilers could show time spent in Perl but not which C functions led to those calls, so the author explores a deterministic profiler that tracks function entries and returns.

## Source excerpt

Recently, I've been working on some BarnOwl branches that move more of the core functionality of BarnOwl into perl code, instead of C (BarnOwl is written in an unholy mix of C and perl code that call each other back and forth obsessively). Moving code into perl has many advantages, but one problem is speed - perl code is obvious a lot slower than C, and BarnOwl has a lot of hot spots related to its tendency to keep tens or hundreds of thousands of messages in memory and loop over all of them in response to various commands.