I took a look at the opcodes generated by these assembly codes :
xor rsi, rsi
mov sil, 0xFF
and
mov rsi, 0xFF
The first code turns into 48 31 F6 40 B6 FF and the second into 48 C7 C6 FF 00 00 00.
- Is code with more instructions slower?
- Is what matters more the size taken up by the opcodes?
- Which code produces the highest performance?
EDIT: in the comments I saw mov esi, 0xFF is a better solution and in a way it is a good answer. I am not sure about this question but what if we look only at the codes I wrote?