On April 25, 2010 at 16:12, Lyndel McGee said...
While developing a Denon module, one has to consider all the information available from the Denon. In short, you get an event/response for lots of things that you may not be interested in. For each event/response, you must look at a minimum of 2-3 characters to see if you want to process it. This takes time and if you are interested in processing "everything", your message processor code can get very large and can be very slow. Regular expressions may help but issuing xxx.test() on 200 regular expressions to find a match on the 201st one is just plain slow. So, while we would like to process everything under the sun, it almost warrants developing several message parsers that can be invoked depending upon the things one might be interested in.
It would introduce more objects, but another approach would be to use an associative array and look-up rather than "process" the return strings. ...trading more objects for fewer statements.
Has anyone compared these two techniques against each other?