|
Posted by Sandman on 11/24/06 15:22
In article <q9vdm2lgir1co34ijp82utfg30ondinqq6@4ax.com>,
Michael Fesser <netizen@gmx.de> wrote:
> >What I'm trying to say is that it's hard to say, when a new page
> >"starts" to know what member info will be presented when it has
> >finnished.
>
> OK, maybe it's not possible for the entire page, but at least for some
> main parts like an article listing, where a whole bunch of member
> informations is required.
Yes, I could - potentially, prefetch that list and then fetch member
info and then print the list. Sure. BUt there needs to be onlyh one
instance of member information being printed outside of this scope to
throw this off as a *solution* to my problem.
> >I realize the benefit of that, but it can't be done *beforehand*.
> >
> >What *can* be done is doing it *after*. I.e. when presented with a
> >member id, the member_name() function only outputs a placeholder for
> >the information, like so:
> >
> > Post from [[MEMBERINFO::1234]] on 2006-11-23:
>
> When you fetch articles from the database, you know who wrote them. It
> doesn't really matter if it's a member or a visitor.
Right, which means I can't do a "select from articles,members
wherearticles.member = member.id..." select since that would leave out
all article where member is null, i.e. written by a visitor.
> Actually I can't imagine that it should not be possible to fetch the
> articles, get the member IDs from them (if available) and then fetch the
> member informations. Would take just 2 or 3 queries.
Right, I agree with you - that can be done - for that particular case.
I feel like we're going in circles. I have a problem - the problem is:
I have to be able to display information about an arbitrary member
at any given time without loading information about ALL members
Your solution is to make the member ids NOT be arbitrary, which is
only possible to a certain degree without rewriting my entire
1,200,000 line CMS project from scratch or something like that.
My basic solution has been thus far:
1. Coming up with a system where acquiring information about just ONE
member at any given time isn't time consuming should it be done 500
times for a page.
2. Printing placeholder information about member id's and post-process
the output buffer with the relevant information.
In 1, I was thinking about aggregating individual member info to text
files on the HD, and I will shortly test this to measure load times
for this, if file() is faster than mysql_query() and
mysql_fetch_assoc()
> >And then, when processing the output buffer, I replace all these with
> >the proper information, and only fetch what member_name() has saved in
> >$GLOBALS["displayed_members"] or something like that.
> >
> >Problem with THAT is that the page may contain one hundred, or maybe
> >five hundred such placeholders, and selecting something with "and id
> >in(<list of 500 id numbers>)" takes a lot of time (a lot more than
> >0.16 seconds).
>
> Did you really test that?
Yes.
> >And then preg_replacing() them after selecting them
> >also takes some time.
>
> str_replace() would be enough in this case, but of course it would still
> require some time.
Yes, my mistake. Sorry. :)
--
Sandman[.net]
Navigation:
[Reply to this message]
|