What I finally decided to do was remove the code that was doing the strcmp()s in the first place.
The existing optimization code was a little goofy; when a log was coalesced (at this point, mostly done by sp_document_maybe_done()), it iterated over the entire (combined) log, looking for consecutive actions to combine.
The new approach is to do that check every time an action is added to the log, and when two logs are joined by sp_repr_coalesce_log(), only the head and tail of the two logs are optimized in this fashion.
The new code doesn't use strcmp() anymore, and only tries to optimize one pair of events a time, so this should prove less expensive overall.
It probably is worth investigating at some point whether doing these optimizations is worth it at all, but for now this should do.
-mental