Customizing SMF > SMF Coding Discussion

Overhead

(1/1)

asmith:
Hello,

I'm rewriting my topics url. I've put a function name into $modSettings['integrate_buffer'] so that I manipulate content there without touching SMF's code.

Everything works fine except that I noticed I'm creating a big overhead.
I'm basically gathering all topic ids in this function and I'm running an sql query to topics table to get some info about that topic, this is my debug info:


--- Quote --- UPDATE smf_log_activity
SET
   hits = hits + 1
WHERE date = '2012-08-30'
in ...\Sources\Subs.php line 3144, which took 0.00056386 seconds at 0.07514405 into request.

SELECT t.id_topic, t.id_board, m.subject
FROM smf_topics AS t
   INNER JOIN smf_messages AS m ON m.id_msg = t.id_first_msg
WHERE t.id_topic IN (748)
in ...\Sources\Subs-TUS.php line 3274, which took 0.00037479 seconds at 0.33442712 into request.

--- End quote ---

As you can see the line before the last is ending in 0.07 (that's the very last SMF query which is tracking my page views), but even though my topic query is getting 0.0003 seconds it is jumping to 0.3s. I'm guessing that at my function maybe SMF has closed connection to db and my query is forcing it to reopen connection and that is causing extra delay?
I tried removing my query and everything went back to normal. What's with the overhead? Am I looking into the wrong place?

emanuele:
Just tried, but I can't see any overhead in doing a query close to integrate_buffer...

So if you remove that query the page is created in ~0.07 seconds?

asmith:
I think I was confused before. I took the last line of sql queries in show queries as page creation time. I enabled SMF Page created time and it is the same. Doesn't have anything to do with query. (extra query was telling me the very last page creation time)

I've also noticed my function is getting called twice. Why is that? Test it in on another forum too.

emanuele:

--- Quote from: asmith on August 30, 2012, 12:12:56 AM ---I've also noticed my function is getting called twice. Why is that? Test it in on another forum too.

--- End quote ---
Tricky to say.
Are you sure it's present only once in $modSettings['integrate_buffer']?

Navigation

[0] Message Index

Go to full version