typo3-realurl icon indicating copy to clipboard operation
typo3-realurl copied to clipboard

Turning ConfigurationReader into a Singleton increases performance on sites with a lot of domains

Open ponyfleisch opened this issue 7 years ago • 3 comments

I'm running a TYPO3 installation with about 480 domains in sys_domains (regional newspapers with alternative URLs for dev/staging/production.

A significant portion (~5-10%) of the request lifecycle is taken up by setHostnames() called by the constructor of ConfigurationReader, because it is called several (somewhere between 10-100, depending on page) times. I assume it's once per link.

Turning ConfigurationReader into a Singleton reduces that. Are there any unintended consequences of that? If not, do you want me to submit a pull request for it?

ponyfleisch avatar Dec 26 '16 04:12 ponyfleisch

It has to be different for encoding and decoding.

dmitryd avatar Feb 11 '17 09:02 dmitryd

I was thinking about this as well, a singleton would be better. The encoding, decoding modes could be made to be manually switched on a singleton by separating the __construct routines to a manually called static function.

ConfigurationReader::init($mode, array $urlParameters = array());

And then in that init function the arguments supplied can be compared to what is currently set. If they differ the hostnames etc can be reset. That would reduce the number of calls to setHostnames.

Just my 2c.

marvin-martian avatar Feb 21 '17 10:02 marvin-martian

Host names will be different in your case. So singleton here will not work anyway. I think caching or optimisation is what is needed here.

dmitryd avatar Feb 26 '17 15:02 dmitryd