add_action.. will work if function is empty?

The function will run, but nothing will happen. There is a small overhead, but you shouldn’t worry about it, the possible savings are minimal.

Depending on when you have $checked available, you could also do

function example() {
    echo 'true';
}
if ($checked) add_action('wp_head', 'example');

techhipbettruvabetnorabahisbahis forumuedueduseduseduseduseduseduedueduedus