Open alexander-schranz opened 2 years ago
That would mean generating 450+ classes, which seems counter-intuitive to me.
Is there any other projects doing that? Or is there any data points that would help taking a decision? I have no strong opinion on this really, but I want to be sure we have a real problem at hand.
As example I can give you Azure App Services which has a really slow IO on this kind of files and there its better this can live somewhere else then read always from the harddisk and opcache is mostly the simpliest thing without any additional cache layer.
And I would create a class per icon so only the files opcache which are really used. I would mark the generated classes as @internal
so they will not be used directly and we can change them the way we want in the future.
Currently
file_get_contents
is everytime used to load the icon. This means it need to load and read the icon from the filesystem. This can be an overhead. I would suggest to create a script which will create a PHP class per icon e.g.:Then we can get the icon with:
The advantage of this is that the icon are cacheable inside the
opcache
of php and don't need to be loaded everytime when being accessed. Thesvg
I would keep in the repository, the classes could be generated over a script inside this repository and so the classes are easy to update if you update the resources directory with new icons. What do you think?