mochafella mochafella

Niner since 2004


  • Gary Daniels and Evan Goldring - Mock whiteboard problem

    that was for "TimP" by the way.
  • Gary Daniels and Evan Goldring - Mock whiteboard problem

    Just stumbled across this, I'm not sure though if your question was answered, but here's my widow's mite. Yes a char by char check is more efficient.

    A level lower and a look at the asm/binary generated by your compiler would reveal the external calls made using the second option. Now realize that every single func call would force your processor to save its registers to mem and eventually restore them as well as set-up stack frames and a return address.

    With the first option you would likely find a simple reg/reg comparison and jump. Progression thru the arrays would likely be accomplished thru pointer arith.

    Compilers are pretty smart but relatively unnecessary clutter fools them. More elegant with func calls but you'll take a processing hit.