Re: do you REALIZE how much memory all the messages would take?!?
Reply #1 – June 10, 2013, 05:36:16 pm
In your refactoring, did you pull every single message into $context before sending it to the template? That's really what the point of the callback is about, is that even with a mammoth topic, the peak memory usage should never be that high. For comparison, consider the print page memory usage on a similar situation.
Re: do you REALIZE how much memory all the messages would take?!?
Reply #3 – June 10, 2013, 06:38:57 pm
The first thing to note is that if you have it as a callback, you won't pull 44MB of memory use (most hosts allow 32MB) but I dread to think what will happen if you plug in 'All' posts into something like the Aeva thread under that situation (close to 7k posts IIRC) Keeping the callback does allow you curtail peak memory usage, however I'd like to know how you're burning > 30MB when the peak should be only a modest fluctuation. I wonder if it's related to output buffering, actually.
Re: do you REALIZE how much memory all the messages would take?!?
Reply #6 – June 11, 2013, 05:18:25 am
Hmm, the unbuffered aspect makes sense. SELECT * on the other hand... not so much. Yes, pulling every column from a table is so much more efficient than only pulling the ones you need (though for messages, it largely is every column) SMF and Elk as they stand cannot use unbuffered queries because of the DB abstraction (PGSQL doesn't support it, don't believe SQLite does either) but maybe Wedge could. It's just weird that you're getting those figures, because cases of large amounts of messages can occur (all posts in a topic at once)... makes me wonder how much of that memory usage is tied to attachments and members and not the posts as a whole.
Re: do you REALIZE how much memory all the messages would take?!?
Reply #7 – June 11, 2013, 05:39:49 am
emanuele
Global Moderator
Attachments none because is a randomly generated forum created using populate and it doesn't add attachments. Members...mmm...possible since in the topic there are 1054 different members (result of count($posters)). I'll generate a similar topic with just 1 member to see the difference.
Re: do you REALIZE how much memory all the messages would take?!?
Reply #8 – June 11, 2013, 06:29:13 am
Tell you what I'd do, actually... set $context = array() just before pulling everything, taking the memory at that time (not peak) and taking the memory after that... if memory use is already 10MB on 100 messages, and 40MB on 1000 messages, 900 messages = 30MB. So how much of that 10MB is other overhead?
Re: do you REALIZE how much memory all the messages would take?!?
Reply #10 – June 11, 2013, 12:58:27 pm
In typical Arantor fashion, the topic is being pulled to superfluous debate and name-calling. I'll withdraw everything I posted and go on my merry way.