[drupal-devel] Fwd: history-table
dries at buytaert.net
Mon May 9 18:31:47 UTC 2005
On 09 May 2005, at 18:55, Dries Buytaert wrote:
> On 09 May 2005, at 13:05, Gerhard Killesreiter wrote:
>> We have two different implementations of checking the new-ness of a
>> wrt the current user:
>> _forum_user_last_visit selects all history entries and populates a
>> static array when first called.
>> node_last_viewed will execute a query per nid (and cache the result in
>> a static array too).
>> We should find out which one is faster, use only that, and remove the
>> other function (the new function should be in node.module of course).
> That or _forum_user_last_visit() should only load/cache information
> about the nodes in the relevant forum (i.e. add a left join). Even
> so, we risk doing some work twice. We'll need to do some profiling
> for this ...
I did some quick measurements.
1. If one has a small history (40 rows in the history table),
_forum_user_last_visit() is faster than node_last_viewed().
2. If one has a large history (550 rows in the history table),
node_last_viewed() is slightly faster than _forum_user_last_visit().
The difference is less than 10 ms but most of the time
_forum_user_last_visit() is the fastest. If we change the current
behavior to tidy up or unify the code, performance is going to degrade
slightly. Unless, of course we can improve the performance of
Dries Buytaert :: http://www.buytaert.net/
More information about the drupal-devel