On Sat, Oct 10, 2009 at 9:11 AM, Vinay Sajip <vinay_sa...@yahoo.co.uk> wrote:
>
>
>
> On Oct 10, 1:56 pm, Simon Willison <si...@simonwillison.net> wrote:
>> I just hacked in a logger that increments a counter for every message
>> - it indicates that there are 158,527 SQL statements executed by the
>> test suite, which means we should expect to add slightly over a second
>> to the time taken for the overall unit tests based on the
>> microbenchmark.
>
> You don't need to hack a logger to do this - you can just add a Filter
> which passes everything but counts as it goes.
>
> Anyway, the numbers don't look too bad at the moment :-)
>
> Regards,
>
> Vinay Sajip
> >
>

It's worth noting that though we should be considered with extreme
effects were they to occur, over in Mountain View we have some friends
working to make this not an issue for us :) .  If Django is run under
Unladen Swallow the result of all of these calls will be that both the
logger function itself, and the code that calls it (for example the
execute SQL query function) will be considered HOT by the interpreter
and compiled down to machine code.  There at that stage the compiler
will be able to apply some nice heuristics and since this function
never gets monkey patched or changed the compiler will be able to
inline it.  Since almost all log handlers will be trivial, the
inlining will effectively give us 0-overhead logging.

Compilers are awesome'ly yours,
Alex

-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to