dpalou / moodle-filter_applink

Moodle filter plugin. It makes easier to create links to open the Moodle app.
1 stars 1 forks source link

Performance improvement #1

Closed mudrd8mz closed 5 years ago

mudrd8mz commented 5 years ago

It is a common and good practise in filters to perform a quick and cheap precheck prior starting up the regex which is slower.

In your case, let me suggest to do a simple strpos() check to see if a substring data-app-link is even present in the text, and if not (which is majority of cases), return early from the filter_applink::filter() method.

dpalou commented 5 years ago

Thanks David,

I added a new commit to fix this:

https://github.com/dpalou/moodle-filter_applink/commit/a3e4754073385e5aaa5d9c82ff169b801eb0e2b7