Skip to content

Don't cache a whole repo string in Utils::getRepoStrings()  #591

Closed
@pascalchevrel

Description

@pascalchevrel

While looking at this api call and seeing how we can make it faster:
https://transvision.mozfr.org/api/v1/tm/global/en-US/fr/Cancel/

I noticed that the page renders much faster and wjth less memory if I disable the cache:
With cache:
[Tue Jan 19 16:57:56 2016] Memory peak: 38535168 (36.75MB)
[Tue Jan 19 16:57:56 2016] Elapsed time (s): 0.6915
Whithout cache:
[Tue Jan 19 16:58:15 2016] Memory peak: 23592960 (22.5MB)
[Tue Jan 19 16:58:15 2016] Elapsed time (s): 0.3894

I digged into it and I see that I think I made a conceptual error in the function getRepoStrings()

This function will always return the full included PHP file ({$locale}/cache_{$locale}_{$repository}.php) so we don't need to put that file in cache because that means that everytime we need to work on the full set of strings we serialize/unserialize it.

That is true will all views using getRepoStrings() but it is particularily noticeable on the global api one because it needs to load strings for all reporitories so we spend 30% of the page time view in unserialize().

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions