in reply to Re^2: Challenge: Construct an unpack string
in thread Challenge: Construct an unpack string

If you hardcode the template to unpack, of course it will be quicker--but when the input data changes, the template won't without programmer intervention--which kinda negates the value of the benchmark.

Actually, your entire benchmark is pretty suspect and you are comparing a bunch of entirely different things:

  1. A hardcoded unpack.
  2. Two different implementations of the original challenge: parsing the data according to the contents of the input structure.
  3. Three other bit of random code that do nothing in particlar to do with the problem--your "setup" stuff.

So, no. I wouldn't agree that this is a valid benchmark :) Sorry.

Also, please use cmpthese for benchmarking, the output from timethese is all but unintelligable.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.