{"action":"closed","issue":{"url":"https://api.github.com/repos/piwik/piwik/issues/6060","labels_url":"https://api.github.com/repos/piwik/piwik/issues/6060/labels{/name}","comments_url":"https://api.github.com/repos/piwik/piwik/issues/6060/comments","events_url":"https://api.github.com/repos/piwik/piwik/issues/6060/events","html_url":"https://github.com/piwik/piwik/issues/6060","id":41043552,"number":6060,"title":"Improve performance by caching all translations in a flat array","user":{"login":"tsteur","id":273120,"avatar_url":"https://avatars.githubusercontent.com/u/273120?v=3","gravatar_id":"","url":"https://api.github.com/users/tsteur","html_url":"https://github.com/tsteur","followers_url":"https://api.github.com/users/tsteur/followers","following_url":"https://api.github.com/users/tsteur/following{/other_user}","gists_url":"https://api.github.com/users/tsteur/gists{/gist_id}","starred_url":"https://api.github.com/users/tsteur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsteur/subscriptions","organizations_url":"https://api.github.com/users/tsteur/orgs","repos_url":"https://api.github.com/users/tsteur/repos","events_url":"https://api.github.com/users/tsteur/events{/privacy}","received_events_url":"https://api.github.com/users/tsteur/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/piwik/piwik/labels/c%3A+Performance","name":"c: Performance","color":"ededed"},{"url":"https://api.github.com/repos/piwik/piwik/labels/c%3A+Platform","name":"c: Platform","color":"bfe5bf"},{"url":"https://api.github.com/repos/piwik/piwik/labels/Easy+pick","name":"Easy pick","color":"fbca04"},{"url":"https://api.github.com/repos/piwik/piwik/labels/Enhancement","name":"Enhancement","color":"bfd4f2"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/piwik/piwik/milestones/40","labels_url":"https://api.github.com/repos/piwik/piwik/milestones/40/labels","id":713718,"number":40,"title":"Mid term","description":"You may expect these tickets to be worked on within 1 or 2 years.\r\n\r\nLearn [how Piwik software is developed and released.](http://developer.piwik.org/guides/core-team-workflow)","creator":{"login":"mattab","id":466765,"avatar_url":"https://avatars.githubusercontent.com/u/466765?v=3","gravatar_id":"","url":"https://api.github.com/users/mattab","html_url":"https://github.com/mattab","followers_url":"https://api.github.com/users/mattab/followers","following_url":"https://api.github.com/users/mattab/following{/other_user}","gists_url":"https://api.github.com/users/mattab/gists{/gist_id}","starred_url":"https://api.github.com/users/mattab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattab/subscriptions","organizations_url":"https://api.github.com/users/mattab/orgs","repos_url":"https://api.github.com/users/mattab/repos","events_url":"https://api.github.com/users/mattab/events{/privacy}","received_events_url":"https://api.github.com/users/mattab/received_events","type":"User","site_admin":false},"open_issues":378,"closed_issues":131,"state":"open","created_at":"2014-06-01T00:00:00Z","updated_at":"2015-01-05T10:45:22Z","due_on":"2016-12-21T08:00:00Z","closed_at":null},"comments":0,"created_at":"2014-08-25T08:50:43Z","updated_at":"2015-01-05T10:45:22Z","closed_at":"2015-01-05T10:45:22Z","body":"In #5863 we do already cache plugin translations. Thinking a bit further we could do this for core translations as well. This alone wouldn't bring a huge performance improvement since we would save more or less only the `json_decode`. But we could save plugin and core translations in a flat array as it was originally:\r\n\r\n```\r\n$translations = array('Actions_Key' => '', ...);\r\n```\r\n\r\nhttps://github.com/piwik/piwik/blob/master/core/Translate.php#L172\r\nhttps://github.com/piwik/piwik/blob/master/core/Piwik.php#L829\r\n\r\nThose methods are often called > 1000 times in each page request. It would still bring only 10-40 ms which does not seem a lot but if you think about that the median API response time of some \"competitors\" is less than 10ms in total it is a lot."}}