You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.
When replacing domains in big strings, it's possible that memory leaks happen. One possible way to handle that is breaking the string in smaller chunks but I'm not sure if that would actually help. I have to run some tests to see how the plugin logic behaves on those cases. Here is an example of a related issue that required memory increase: https://wordpress.org/support/topic/error-output-on-wp-json-oembed-sites-urls/.
The text was updated successfully, but these errors were encountered:
According to this answer on StackOverflow, it seems that mb_eregi_replace use less memory than preg_replace. I didn't benchmark them yet, but I'll definitely give a try when I have a chance.
If someone has any thoughts on this approach, please let me know.
I could confirm that mb_eregi_replace consumes less memory when compared to preg_replace. However, it takes more time to execute. Here are the average metrics for a ~12Mb string:
mb_eregi_replace
Memory: 14.3Mb
Exec. time: 3.16s
preg_replace
Memory: 31.4Mb
Exec. time: 0.16s
Even smaller strings take around 2s with mb_eregi_replace. Perhaps we should have both options and leave for the site owner to switch between preg_replace for faster execution or mb_eregi_replace for lower memory usage.
When replacing domains in big strings, it's possible that memory leaks happen. One possible way to handle that is breaking the string in smaller chunks but I'm not sure if that would actually help. I have to run some tests to see how the plugin logic behaves on those cases. Here is an example of a related issue that required memory increase: https://wordpress.org/support/topic/error-output-on-wp-json-oembed-sites-urls/.
The text was updated successfully, but these errors were encountered: