Setting a value when the var has already the right value

On an update method, let’s say we have something like this

public void update() {
    var1 = var2

What happens when var1 already have the same value than var2 ? is this instruction decrease the performance of the game doing it every frame? Or not at all ? Is “if (var1 != var2) var1 = var2” better in terms of performance?