r/linux • Social Justice Warrior • Sep 03 '14

I'm Matthew Garrett, kernel developer, firmware enabler and former fruitfly mangler. AMA!

482 Upvotes

381 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Sep 04 '14

[deleted]

6

u/ramennoodle Sep 04 '14

If performance is the only thing that counts for you, and it sounds like, you should use assembly. Serious.

This is not true. There are many cases where optimizing compilers do a better job than hand-written assembly. And may cases where hand optimization of code isn't worth the trouble. Unless you have a really good understanding of both the hardware and why the compiled code is deficient, it is not better for performance to use assembly.

0

u/[deleted] Sep 04 '14

[deleted]

3

u/ramennoodle Sep 04 '14

I don't need to read an article to know that null-terminated strings are problematic. But how does using assembly help that? You still need some representation for strings. You can define other string representations in C (assuming you don't mind reimplementing some stuff from string.h, which you'll be implementing anyway if you're writinga kernel from scratch.) And null-terminated strings are quite common in assembly as well (see x86 .asciz directive.)

→ More replies (3)