Re: Constructive criticism

new topic     » goto parent     » topic index » view thread      » older message » newer message
DerekParnell said...

The first thing to note is that you have reminded me of that optimisation technique. Your version of the routine takes half the time than my original one. Even though you seem to be saying that it should be slower, it is fact much faster.

In fact, what happens is that repeated subscripting stacks[stack][$] requires extra references (basically, assignments to temporary variables), and requires more copy on writes. In particular, Derek's code causes two copies, while Critic's causes only one. So there are two savings, in that fewer copies are made, and fewer subscript operations are made.

The difference would be more pronounced with larger stacks.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu