[geeklog-devel] Speeding Up Geeklog
Tom
websitemaster at cogeco.net
Fri Jun 21 15:28:57 EDT 2013
Okay
I have updated the code to use cache files for the $_TOPIC tree array it the
admin has caching enabled. So right now there are 2 ways it is stored. The
second way is when caching is disabled the logged in users topic tree info
is stored in the sessions table along with the anonymous users stored in the
vars table.
With my test db of only 13 topics to create (I can see sites using a lot
more topics (I have one planned with over 50)) it takes
0.012622833251953 seconds
on average to create the topic array. To retrieve the topic array from the
session variable or cache file it takes about the same time (cache is
slightly faster) at
0.00091695785522461 seconds
So storing the data is much quicker. Plus the more topics you have the
greater your time savings will be.
Tom
-----Original Message-----
From: geeklog-devel-bounces at lists.geeklog.net
[mailto:geeklog-devel-bounces at lists.geeklog.net] On Behalf Of Tom
Sent: June-21-13 6:50 AM
To: 'Geeklog Development'
Subject: Re: [geeklog-devel] Speeding Up Geeklog
Thanks Joe,
I will look into this (I have yet to add the caching function to stories and
have only reviewed that part of the story code). I didn't think of the CTL
for this type of work (something that is not really displayed).
I will still probably keep my existing code of the session variables for
those who don't enable the caching part on their sites. I am sure a few will
and the speed savings for any who have more than a few topics will be worth
it.
Tom
-----Original Message-----
From: geeklog-devel-bounces at lists.geeklog.net
[mailto:geeklog-devel-bounces at lists.geeklog.net] On Behalf Of Joe Mucchiello
Sent: June-20-13 4:41 PM
To: Geeklog Development
Subject: Re: [geeklog-devel] Speeding Up Geeklog
The CTL has CACHE_* functions just for this. You pass the array to the
function and it is written to the cache directory. You can then load it or
regenerate it based on how old it is. See glFusion's story/article handling
for examples. (And in the case of the TOPICS array, the decision to
regenerate it is basically NO unless someone is doing topic editing in the
admin screen. You would add the calls to regenerate the anonymous array, and
delete any individual arrays, to the topic save functions.)
Writing it to the gl_vars table still requires a database call. A file in a
cache directory is many times faster.
This was one of the primary purposes of CTL (perhaps even ahead of adding
template features to the ancient phplib template library). In 2008 I did a
lot of profile runs of Geeklog and the CACHE_ functions were there to cut
down of repeated and needless database accesses.
> To speed up Geeklog when it creates the $_TOPICS array I have created
> a session variable to store the topic tree information for each user.
> Topics hardly ever get updated so there is no point in creating the
> tree from the db every single page load. This now only happens if a
> topic gets created, updated or deleted (or the user security changes).
>
> This is working well but I can increase this further by allowing
> anonymous users to share the topic tree (since it is the same for each
> anonymous user).
>
> For this though I need the text database column data type. Does anyone
> have a problem for the gl_vars table if I change the type for the
> value column from varchar(128) to text?
>
> Thanks
>
> Tom
>
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://eight.pairlist.net/mailman/listinfo/geeklog-devel
>
_______________________________________________
geeklog-devel mailing list
geeklog-devel at lists.geeklog.net
http://eight.pairlist.net/mailman/listinfo/geeklog-devel
_______________________________________________
geeklog-devel mailing list
geeklog-devel at lists.geeklog.net
http://eight.pairlist.net/mailman/listinfo/geeklog-devel
More information about the geeklog-devel
mailing list