Daniele Esposti's Blog

Count elements in an iterator

Counting elements in a list, tuple or dictionary in Python is trivial, count the elements in a iterator is not. Because of the nature of a generator it’s not possibile to know how many elements will be returned from the iterator, only one element is returned at time and the...


Disassembly C code for fun - Part 3: for loop

…And it’s already the third post about disassembly C code for fun. Today we disassembly a simple for..loop cycle Update: Don’t miss the next post Disassembly C code for fun – Part 4: floats and SSE2 Disassembly time First the C code: #include <stdio.h> int main() { for (int i...


Disassembly C code for fun: part 2

So, in the previous post Disassembly C code for fun: part 1 I didn’t used as example the well known “Hello World!” code, but for a good reason: I need to explain some basics of the disassembly process (prologue, epilogue, stack, etc.) before proceed any further. Anyway in this post...


Disassembly C code for fun: part 1

I’m currently reading The C Programming Language by Ritchie and Kernighan to learn the C language from ground zero. I already write sometimes C/C++ code but it’s always a good idea to learn a already known language from the chapter 1 specially if you learn it by practice skipping the...


Python 3 annotations and performances

Python 3 introduced the concept of parameter and return type annotation with PEP 3107. Other interpreted languages supports type annotations for example ActionScript3 and this improved the quality of the generated byte-code and the execution speed because the interpreter can output specialised code for the annotated type. But does is...