Typically, if the function that you are trying to perform naturally works in a hook, you should prefer that method.
It really depends on what you are trying to do. In this case, I would probably use the set_task() because it's easier to understand what the code is doing and as far as efficiency goes it's going to be negligibly different.