# Forums | Mahara Community

## Developers / Latency smarty header_logo_small

Posts: 11

03 May 2019, 3:25 AM

public function header_logo_small() {
if (!empty($this->headerlogosmall)) { returnget_config('wwwroot') .'thumb.php?type=logobyid&id='.$this->headerlogosmall;
}
else {
require_once('ddl.php');
$table = newXMLDBTable('institution');$field = newXMLDBField('logoxs');
if (field_exists($table,$field) && $sitelogosmallid = get_field('institution', 'logoxs', 'name', 'mahara')) { returnget_config('wwwroot') .'thumb.php?type=logobyid&id='.$sitelogosmallid;
}
}
returnfalse;
}

In this function compare to header_logo, why using ddl.php and newXMLDBTable / Field. It's not ncessary and that's create many latency when i test with a profiler.

Thank You
Posts: 488
##### Re: Latency smarty header_logo_small

03 May 2019, 12:24 PM

Hi Aurelien,

The reason we have the field_exists() call for when one is upgrading from an older version that field wont exist yet and so breaks site / not allow them to upgrade.

Having said that we should use a more direct test to see if table column exists rather than creating the table / field xml objects and testing via adodb.

As we only use support mysql / postgres we could have a simplified function to do this and hopefully reduce the overhead

I've begun a bug report https://bugs.launchpad.net/mahara/+bug/1827445 and created a patch https://reviews.mahara.org/#/c/9950/ to deal with this.

From my initial tests there does seem to be an improvement in doing the check directly via a database call in both  postgres and mysql

Cheers

Robert

Posts: 11
##### Re: Latency smarty header_logo_small

04 May 2019, 12:29 AM

Good news, i continue my work to try to improve performance.

Regards

Posts: 3772
##### Re: Latency smarty header_logo_small

04 May 2019, 9:42 AM

Hi Aurelien,

It would be wonderful if you tested the change that Robert made at https://reviews.mahara.org/#/c/9950/ over the course of the development work and checked from your end if you see improvements.

You can use your Launchpad ID to log into the review system and add yourself as reviewer to be notified when changes are made.

Thank you

Kristina

Posts: 11
##### Re: Latency smarty header_logo_small

09 May 2019, 12:22 AM

Hi Kristina,

Here the result for 125 users concurrent in 30 minutes (using Jmeter), see the graphs

Before your modification :

After your modification :

There is a major improvement in response time. We should continue our work to identify where the code consume more ressources and returns a long reponse time.

Regards

Posts: 3772
##### Re: Latency smarty header_logo_small

12 May 2019, 11:29 AM

Thank you for the testing and sharing the results, Aurelien.

Cheers

Kristina

6 results