Wydajność to jedna z najważniejszych cech aplikacji tworzonych przez profesjonalistów. Należy ją uwzględniać od samego początku prac nad aplikacją. Tymczasem języki wysokiego poziomu i szybkie procesory sprawiły, że dziś programiści kładą niewielki nacisk na wydajność. Jednak źle dobrane typy danych i niewłaściwie użyte instrukcje języka wysokiego poziomu mogą spowodować, że kod maszynowy powstały w wyniku kompilacji nie będzie działać odpowiednio szybko. Utworzenie optymalnego i wydajnego programu może znacznie ułatwić wiedza o tym, jak kod wysokiego poziomu zostanie przekształcony w kod maszynowy.
W książce "Profesjonalne programowanie. Część 2. Myśl niskopoziomowo, pisz wysokopoziomowo" znajdziesz wyczerpujące informacje dotyczące wyboru typów danych i maksymalizowania wydajności aplikacji. Nauczysz się dobierać odpowiednie instrukcje języka wysokiego poziomu tak, aby kompilatory optymalizujące mogły na ich podstawie generować wydajny kod maszynowy. Poznasz także elementy asemblera procesorów 80x86 i PowerPC w zakresie niezbędnym do czytania ze zrozumieniem kodu generowanego przez kompilator.
Another book from the series “Write Great Code”, but this time focused on translating high level constructs into the low level machine code (assembly mnemonics, to be specific).
Previously, we were learning about the machine itself, how can we build one, how can we tell it what to do via its machine code instructions.
Now, we are focusing on how can we use more high level languages to program the machine and not thinking about the machine code it translates to. Well, we do in this book :)
What I liked specifically here is that this book is full of snippets both of high level language code and its low level implementation that were emitted via some compiler.
Like, literally. For instance, you are reading a chapter about if clauses and then you are seeing one in Swift language for example and then you are looking at the machine code that Swift compiler emitted for this if clause. In my opinion this is huge. So I liked it.
However, there is really a thin layer of “too much snippets” vs the explanations. So, that’s why I give 3/5. It is ok, it’s full of concepts and explanations of how compilers translate high level language into its low level implementation, but in my opinion there is too much of them. I was basically skipping at the end of the book lots of pages.
But anyway, recommend to those who are interested in how high level languages are being compiled into something that the machine can actually do.
Really interesting book! I think I will revisit it and the others in this series after I have more assembler experience.
Had some aha moments with assembly code created from Swift and running on Apple Silicon. Well worth the read I would say, and if you have access to some different cpu architectures, write and run some small assembly code on them and you will probably find even more useful parts
Its ok, not the best book to read if you are a beginner. It's nice to learn a few things about what is going on "under the hood" but nothing in this book will make your code significantly better.