Timeline for What is faster: hook_form_alter or hook_form_FORM_ID_alter?
Current License: CC BY-SA 3.0
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 9, 2016 at 8:57 | comment | added | Clive♦ | Hook implementations are cached, so it really doesn't make a difference. When that cache is rebuilt, every module is tested for every version of hook_form_alter AND hook_form_FORM_ID_alter anyway, so technically you can save a bit of time (microseconds) by lumping everything for one module into a single form_alter hook. But then when that's invoked, you have to check the form ID anyway, which is another OP, and that happens at 'runtime' (no cache). Benchmark that difference if you really care, but you're in classic premature optimisation mode here :) | |
Jun 9, 2016 at 8:55 | answer | added | parth.k | timeline score: 1 | |
Jun 9, 2016 at 8:39 | history | asked | user1 | CC BY-SA 3.0 |