Mac::Carbon Profiling: Panther is Faster

pudge on 2004-01-13T08:53:18

Boy howdy, is it. The system is an iBook G3/600 with 256MB RAM. The first test is with Mac OS X 10.2.8.

$ time perl -MMac::Glue -e 'Mac::Glue->new("Finder")->activate' real 0m21.445s user 0m7.100s sys 0m0.510s

$ time perl -MMac::Carbon -e1 real 0m19.885s user 0m6.810s sys 0m0.220s


The second is Mac OS X 10.3.2.

$ time perl -MMac::Glue -e 'Mac::Glue->new("Finder")->activate' real 0m2.067s user 0m1.430s sys 0m0.320s

$ time perl -MMac::Carbon -e1 real 0m1.300s user 0m1.130s sys 0m0.140s


Wow. That's pretty dramatic. More than 10x faster in real, and about 5x faster in user+sys. Why the speedup?

The slowest thing with Mac::Carbon was always in loading the modules on startup, with most of the time spent in dyld. Over 90% of that time in the Mac::Glue test in Mac OS X 10.2.8 was spent in dyld. In the Mac OS X 10.3.2 version it is still over 75%, but, obviously, much less time is spent there.

Before, it was spending over half of its time in link_library_module and add_reference combined, and about 20% in relocate_symbol_pointers/relocate_symbol_pointers_in_library_image. Now, it still spends about 20% in the latter, but the former don't show up at all. And that 20% is a lot less than in the original, since the total time is so much shorter.

I don't know what all that means exactly, but I do know that yeeha, Panther is a lot faster at loading in them shared libraries.