The article demonstrates the ability of the Julia programming language to output an assembly text for any function written in Julia, which is interesting for education. The executable code for three illustrative examples is examined in detail: calculation by formula, branching and cyclic fragments. It is shown that Julia compiler really generates a carefully optimized program, trying to use the fastest executing instructions of the Intel processor. It successfully tries to do without time-consuming arithmetic operations (if possible, the values are calculated in advance, multiplication is replaced by shift and so on). The results for integer data are especially impressive. It is possible to see a whole range of optimization techniques, including those that take into account the features of the algorithm itself: for example, the compiler is able to predict the results of the simplest loop and exclude this loop from the final program. The problem of overflow control in a program is also discussed.The consideration carried out convincingly confirms the usefulness of theoretical knowledge for developing an effectively working program. The described analysis technique is interesting for education, because the importance of a deep understanding by modern specialists of the programming process essence cannot be overestimated. The material can be useful in teaching programming ideas at different levels. The detailed presentation makes the article readable without special preparation.
Read full abstract