gas vs. nasm: which assembler produces the best code?

前端 未结 6 1457
挽巷
挽巷 2021-02-14 02:46

Both tools translate assembly instructions directly into machine code, but is it possible to determine which one produces the fastest and cleanest code?

6条回答
  •  忘掉有多难
    2021-02-14 03:24

    @Brian: that was not the question ...

    @cyber98834: Well, an assembler does what every assembler must do : translate every instruction to its opcode .

    There's no optimization .

    Oh and also, there's not such a thing as a "fastest code" ... Can I ask you a question ? The CPU's speed is static, isn't it ?

    So, you can't make a code run faster because you can't change the CPU's speed .

    But, you can shrink the code so that the CPU handles less amount of instructions, and so takes less time to run .

    I hope you understand what I'm trying to say .

    I suggest you to buy ( or to look for some pdf's, but I don't know if that's legal ) Michael Abrash's Graphics Programming Black Book which covers many optimization lessons .

提交回复
热议问题