Yield vs update

After read about yield,I think many implementations in update could replace by yield,
for example wait some time to fire,move to some place.

And using yield is mush more easier

Question is:

Will yield performance well

Better to use yield than update?

It depends; coroutines generate garbage which has to be collected at some point, but you generally save more time by not running something every frame than you lose by garbage collection. The less often something runs, the more likely it is to be more efficient as a coroutine. But the time it takes to write code is also a legitimate measure of efficiency, and coroutines can be much faster to write and debug than a bunch of spaghetti code in Update.

There’s also InvokeRepeating, which should be used if something repeats at regular intervals, since it’s the most efficient method of doing that and doesn’t generate any garbage.

Im not sure how you have structured it, but this is an idea of good use of update for a fire function.

var canFire:boolean=true;
var delayTime:float;

function Update()
{
    if(canFire)
    {
        if(Input.GetMouseButtonDown(1))Fire();
    }
}
function Fire()
{
    canFire=false;
    
    //Fire bullet
    
    yield WaitForSeconds(delayTime);
    
    canFire=true;
}