Post
Topic
Board Meta
Re: Quoting from locked threads (SMF patch)
by
PowerGlove
on 16/06/2024, 21:59:46 UTC
In fact, if I'd been writing this, I probably would've left the query as-is, since that would've only used a couple of additional miliseconds.
I nearly left it as-is, but that particular spot (just above the query and just below the stuff already establishing a $limit variable) jumped out at me: it's just such a neat/tempting location to place a little optimization like that...

But, thinking about it now and in terms of profiling the code over a day instead of only in request-specific isolation, it could have been a mistake for me to add it: I mean, the additional bytecode generated for testing $context['only_peeking'] and then branching is negligible, but it is present during every invocation of getTopic() (even the invocations that have nothing to do with quoting from locked threads), so depending on the ratio between ;peek requests and ordinary ones, a complete tally of time-saved vs. time-spent might not be as clear-cut as I guessed.