coleifer/peewee — pull request #308 by danthedeckie (2014-02-12 07:13:19+00:00)
Title: refactored _parse to run isinstance less.

I was importing some data, and found it running slower than I thought it should. I profiled, and found that the _parse function was taking the longest, and that 'isinstance' was getting called 259579 times, which was taking a good chunk of it. I've (very naively) refactored the QueryCompiler._parse_node function to call out to per-object methods (which for now is called '_parse_me', but that's easily changed).

This reduces the calls to isinstance down to 97122, and shaves a 10% off my data import time.

Is this a line of optimising worth pursuing?