Customization is always a stone of stumbling (painful process). From one side we have a real requests (issues) from users which always matters. On other hand all of this additional options can turn your lovely theme, plugin or some abstract product to the hell. So what can we do as a developer?
First of all. Write extensible code with opportunity to change some of pieces of your code — reusable code. Classes, interfaces, traits and just splitting long-wrong code into small methods (functions). Some part of users can easily use them without changes in your product. For example, someone can create a widget with his own needs and use internal plugin function
Adding the new filters and actions is not bad idea. Many popular plugins like Jetpack or bbPress have hundreds of filters inside their code. Sometimes even excessively. Each new filter (or action) without any handlers usually not doing a large overhead. It's a microseconds.
10^−3 s millisecond ms
10^−6 s microsecond µs
Much more important is what you're doing on this action by adding new handlers via
add_filter(). For example, requests to the database server (sometimes non-obvious, like getting non autoload option by
get_option()). And you can measure it. The most simple example:
$start = microtime(true);
// Do some stuff here
$end = microtime(true);
echo $start, PHP_EOL, $end, PHP_EOL, $end - $start, PHP_EOL,
It is very simple and sometimes most suitable technique to profile your code. By the way WordPress have internal "stopwatch", checkout
Or you can use XDebug. It may seem very complex to configure. But you can use VVV or any other ready-to-go server. All of them already have properly configured Xdebug and you can just use it - sounds great, isn't it?. If you're using VVV just hit few commands:
That's all! Switch to your IDE and profile your code. Or use VVV internal services like WebGrind. More about this techniques you can find at Code Debugging Wiki. It should be remembered that using Xdebug make effect on the performance, but you can find slow code (bottleneck).
And third. The last thing. WordPress philosophy is Decisions, not Options.