Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance of Kadence_Blocks_Svg_Render->render_icons_dynamically #598

Open
benniledl opened this issue Oct 22, 2024 · 9 comments
Open

Comments

@benniledl
Copy link
Contributor

benniledl commented Oct 22, 2024

Hello,
I have a Problem that Kadence really slows down my site quite a bit (about 400 ms). I have measured it and found that the slowest function is render_icons_dynamically, this one function alone takes up about 140ms on a page load, so about 35% of the overall time.

I just wanted to ask if you could take a look over this function and see if any performance improvements can be made on it.
grafik

@benniledl
Copy link
Contributor Author

Here the measurement on a page where I use quite a few more Icons:
grafik

@kadencewp
Copy link
Contributor

Hey, this function would query custom icons if there are any, which could require requests to the database. On initial hit, this could take milliseconds like you show, but once cached, it should be instant. Are you not seeing this cached? are you not using any caching on your site?

@benniledl
Copy link
Contributor Author

Hey, I am using custom uploaded svg icons. The slowest database query is not even 1ms long and this function runs 300ms so this is not a database issue.
I will be using a page cache once I go online but I want to solve this problem not treat it's symptoms.

I think this function is slow because of string manipulation or something like that. Can you check how a test site of yours slows down the more custom icons you are using?

@kadencewp
Copy link
Contributor

How many custom icons are you using? Are you using a bunch of individual or a set?

@kadencewp
Copy link
Contributor

@oakesjosh can you put this on your list to explore some options

@benniledl
Copy link
Contributor Author

benniledl commented Oct 22, 2024

It's from one library set but each one is an individual svg file that I upload individually.
Rough guess 70 icons on the whole page but at least 50 of them is the same icon.

@oakesjosh
Copy link
Contributor

Hello @benniledl

I've just pushed some caching for our icon parsing, which improves performance with repeated use of the same icons. You should see a noticeable improvement with this change; if not, feel free to reach out, and we can take another look.

@benniledl
Copy link
Contributor Author

Hi @oakesjosh thanks for that!
I have tested your changes but sadly they don't change anything.
The render_icons_dynamically function still runs about 300ms in total on a page load. Do you want me to make some changes that could output some debug information or something?

@oakesjosh
Copy link
Contributor

@benniledl Are you seeing the same slowdown in real world performance? I don't have the pro version of Code profiler, but in my tests, code profiler is reporting 4 or 5 times slower than the actual performance on the front end.

You're welcome to debug, or if it doesn't have any sensitive information, I'd be happy to test on an export of your site. I will take a second look on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants