English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Why is optimized assembly language code the fastest programming language? Do you know?

2007-01-21 16:14:27 · 4 answers · asked by jessica y 1 in Computers & Internet Programming & Design

4 answers

Only if the code is optimized it is the fastest. You mentioned in the question. Why that happens? Well because the speed at which any processing happens in a computer (CPU) would depend on number of clock cycles it requires to complete the steps. If the code is optimized the clock number of clock cycles taken by a CPU would be less. When someone writes ALP code, he would be handling the registers (memory location which CPU uses for processing data) himself. Where as a compiled program of c or c++ would be generated by the compiler(not human) which generally would not be optimized, it might have some unnecessary steps involved to perform simple steps. Hence the number of swaps or clock cycles required for a optimized code would be less (which is easily achieved in ALP).

What is a clock cycle? Every CPU would have an oscillator circuit (Crystal) which would generate square pulses, these pulses would perform all necessary task(like getting data from/to registers) faster the clock, faster would be the processing.

--
Ck
http://www.gfour.net

2007-01-21 21:16:09 · answer #1 · answered by KingPin 3 · 0 0

Because it uses the smallest amount of bytes and when optimized chooses the fastest way to do things because the programmer knows more about the problem (like most of the time a test fails, so falling through is faster than taking a branch.
A compiler can be very good, but in many cases it is going to choose stock code fragments to carry out language tasks.
The big question that arises is whether the time spent optimizing the code and the maintenance of the resulting code is worth in the increase in speed over higher level languages that are faster to write and easier to maintain.

2007-01-22 00:22:36 · answer #2 · answered by Mike1942f 7 · 0 0

You answered your own question: It's optimized!

A compiler has to do less work. Everything else basically gets broken down from the language you use, to assembler (not really, but sort of...) If you start at the "lowest common denominator", you're in a good place. :)

2007-01-22 00:20:30 · answer #3 · answered by cell-hell 3 · 0 0

i think coz the assembly language can be understandable to the processor. there is no need of any compilation or interpretation.

2007-01-22 00:20:48 · answer #4 · answered by fAr stAr 5 · 1 1

fedest.com, questions and answers