View Issue Details

IDProjectCategoryView StatusLast Update
0005928mantisbtperformancepublic2007-10-04 01:41
ReporterMattB Assigned Tothraxisp  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.0.0a2 
Fixed in Version1.0.0rc1 
Summary0005928: Pre-cache the available projects speeds up every page significantly
Description

Working on further speed improvements, I noticed that Mantis sends an individual query out for every project when building the project list at the top of every page. By retrieving and caching all available projects first, the list can be built much quicker.

Added this function to project_api.php:

function project_cache_rows( $t_project_ids ) {
global $g_cache_project;

   $t_project_table = config_get( 'mantis_project_table' );

   $query = "SELECT * FROM $t_project_table WHERE id IN (" . implode(',', $t_project_ids) . ")";
   $result = db_query( $query );

   while ($row = db_fetch_array( $result ))
           $g_cache_project[$row['id']] = $row;
   }

}

Then simply call this function from print_project_option_list, line 364:

project_cache_rows($t_project_ids);

TagsNo tags attached.

Relationships

related to 0005889 closedthraxisp What's with all these queries 

Activities

thraxisp

thraxisp

2005-07-15 18:37

reporter   ~0010791

This function already exists as project_cache_all().

thraxisp

thraxisp

2005-07-15 21:02

reporter   ~0010798

Submitted to CVS.

core/print_api.php -> 1.142

MattB

MattB

2005-07-18 13:32

reporter   ~0010858

project_cache_all does (as its name suggests) cache ALL project rows from the DB.

My implementation caches only those projects to which the user has access - therefore is slightly faster and more secure. Both solutions speed up the system, however.