C++ suffers on another inner loop

Iain McClatchie iainmcc@ix.netcom.com
Thu Apr 23 21:12:00 GMT 1998


Nathan> Try coding it like this:
Nathan> str_hte_t*
Nathan> probe_str_hte2( const char* str, str_hash* hashp )
Nathan> {
Nathan>   str_key_t key;
Nathan>   key.str = str;
Nathan>   str_hash_int* hash = (str_hash_int*) hashp;
Nathan>   return hash->probe_hte( key );
Nathan> }

That's the C wrapper... and the main problem I see is in the inner loop.
Still, I gave it a shot, and got exactly the same results as my posted
code (actually, two instructions were interchanged, with no effect on
speed).

The problem is that seperating the string comparison test into a
seperate inlined function causes egcs to explicitly represent the 
boolean return value in a register, rather than just fold it into
control
flow.  Beyond that, I'm not really clear on what's going on.

-Iain



More information about the Gcc mailing list