- #71
I think practically all the posts are talking about execution speed, not compilation speed. There may be an exception or two.ChrisVer said:Also one thing that seems unclear to me, is the speeding happening in the compilation time or for the program's runtime? In terms for an IDE during Building or during Running your code?
I agree. The time it takes to compile is of little concern--the goal usually is to get the program to run faster.FactChecker said:I think practically all the posts are talking about execution speed, not compilation speed.
First, no computer programmer is going to "dis" any potentially valuable tool. Assembly has huge disadvantages in the areas of maintainability and portability. In the example I gave, it was a multi-core processor, but even so the best product solution required assembly code.ChrisVer said:So far the inputs tend to dissing assembly over the usage of several cores for speeding up the process...? So ASM seems to be losing the privilege it's so proud of?
I've been following this thread closely, and to the best of my knowledge, no one is comparing assembly language and machine code.TMT said:What would be answer for "why we are using assembler and not using machine code?"
And even more, the analogy would be pretty pointless since assembly and machine are the SAME code whereas assembly vs higher level is a comparison of different languages. @TMT , I think you're off base on this one.Mark44 said:I've been following this thread closely, and to the best of my knowledge, no one is comparing assembly language and machine code.
I think both of you could not catch the idea by this example. I mean assembler may be count as high level languages if you consider a program (assembler) takes some line of instruction and create machine code. Same as high level language a program (compiler) takes lines of expression and (mostly) creates assembler (text code) than assembler creates machine code from it. Same pattern implemented. I'm telling that if a program (compiler) taken expression lines process and produce assembler text we can insert more intelligent logic producing assembler text. This logic will help us more.Mark44 said:The question being asked is "why would one choose assembly language over a high-level language?"
no my friend they are not same. One is text (ascii) while other is binaries expressed in numbers. Assembler is providing labels make life easier for addressing. you have to calculate address in machine code. I'm not offering to use machine code. I try to emphasis the design pattern on assembler and high level both aim to help programmerphinds said:ntless since assembly and machine are the SAME code whereas assembly vs higher level is a comparison of different languages. @TMT , I think you're off base on this one
That is NOT a reasonable use of the term "high level language". Assembly is specifically NOT a higher level language. For one thing, assembly is machine code which means there is no possibility of it being independant of the CPU it was written for. Higher level languages are not written for specific CPU's, they are written for humans.TMT said:I think both of you could not catch the idea by this example. I mean assembler may be count as high level languages if you consider a program (assembler) takes some line of instruction and create machine code.
You are completely missing the point. They are the same in that a line of assembly creates a line of machine code. A line of a higher level language can create THOUSANDS of lines of machine code.no my friend they are not same.
Assembly code might have been considered a "high-level" language back in the 1950s, before the advent of true high-level languages such as COBOL and Fortran, but no one today would consider any assembly language as "high level."TMT said:I think both of you could not catch the idea by this example. I mean assembler may be count as high level languages if you consider a program (assembler) takes some line of instruction and create machine code.
I'm going to disagree with you here, Paul, and side with TMT.phinds said:That is NOT a reasonable use of the term "high level language". Assembly is specifically NOT a higher level language. For one thing, assembly is machine code
sub esp,8
83 EC 08
phinds said:which means there is no possibility of it being independant of the CPU it was written for. Higher level languages are not written for specific CPU's, they are written for humans.
NO NOT assembler isphinds said:assembly is machine code
you can't run assembly program before assembling and linkage editing staff.phinds said:written for humans.
this is not true also simple branch is almost same with assembler code generation while using a macro line in assembler will produce several lines.phinds said:You are completely missing the point. They are the same in that a line of assembly creates a line of machine code. A line of a higher level language can create THOUSANDS of lines of machine code.
Which is exactly the point. They are not identical character by character obviously but they are identical in meaning. There is no such relationship between machine code and higher level languages. I know you understand this but it is not just semantics, it's an important distinction. In the early days there was what was widely known as "the principle of one to one correspondance" which stated that a line of assembly is exactly a line of machine code. The advent of macro assemblers began to blur that slightly but it was still close enough for government work.Mark44 said:Clearly they are different, but as you say, one assembly instruction corresponds to one chunk of machine code.
I'd try to give a few arguments to support TMT:phinds said:@TMT I see no point in arguing the point further. We clearly disagree with each other.
;i'm a comment translate to nothing
imalabel: ;translates to nothing
jmp imalabel ;there's some logic needed to translate this to machine code
db 1
db 2
db 3 ; translates to 1 chunk of machine code
It is. He was just making the fairly pointless point that the binary of the ASCII chars of assembly instructions are different than the binary characters of the resulting machine code.ChrisVer said:Wait, I am confused- why is jmp an example for not 1-to-1 correspondance between assembly and machine code?
My point was that the translated instruction is different depending on the address of the target of the jump. The assembler needs to figure out this address during compilation. So it's not really 1:1 correspondence between what you write and what results. Some CPUs have relative addressing of jumps, soChrisVer said:Wait, I am confused- why is jmp an example for not 1-to-1 correspondance between assembly and machine code?
jmp imalabel
TurtleMeister said:I think TMT has been misunderstood. Maybe English is not his first language? Anyway, I get the gist of the point he's trying to make.
wle said:I think the point is that programming languages are normally considered "high-level" or "low-level" depending on how much they abstract the details of the hardware you're programming on. So Assembly is "low-level" because you're expressing how a program should accomplish some task directly in terms of the set of instructions supported by the processor. C is higher-level than Assembly but still a relatively low-level language: it hides the specific processor instruction set, but its feature set still largely corresponds to that of a sort of hypothetical "generic" processor and addressable memory. (One of C's nicknames is "portable assembly".)
Higher-level languages offer more insulation from the hardware, e.g. with features like automatic memory management, built-in collection types like lists and associative arrays, arbitrary-size integers that don't overflow, an exception system, anonymous functions/closures, dynamic typing, code and/or object reflection/introspection capabilities, etc.
TMT said:I think both of you could not catch the idea by this example. I mean assembler may be count as high level languages if you consider a program (assembler) takes some line of instruction and create machine code. Same as high level language a program (compiler) takes lines of expression and (mostly) creates assembler (text code) than assembler creates machine code from it. Same pattern implemented.
phinds said:That is NOT a reasonable use of the term "high level language". Assembly is specifically NOT a higher level language.
Assembly is not a higher level language. If you choose to call it so, you are defying standard terminology and people will disagree with you.
TurtleMeister said:I do not think TMT is claiming that assembly is a high-level language
TMT said:... assembler may be count as high level language
phinds said:Well, I guess I was misled by his saying:
TMT said:... assembler may be count as high level languages
Which clearly states that (following the OP's question) assembly language is to machine code, what other programming languages are to assembly language.TMT said:I mean assembler may be count as high level languages if you consider a program (assembler) takes some line of instruction and create machine code. Same as high level language a program (compiler) takes lines of expression and (mostly) creates assembler (text code) than assembler creates machine code from it. Same pattern implemented.
Let's not refer to assembly and macro-assembly as "high level languages". That phrase was coined specifically to exclude such languages.TMT said:I mean assembler may be count as high level languages if you consider a program (assembler) takes some line of instruction and create machine code.
Well, I think that everyone here would agree that:jim mcnamara said:I'm going to stay out of this. But there are definition issues. Clear debate requires that every use the same terms with exactly the same meaning. Can we agree on meanings?
We also seem to have ESL issues, too. I've been part of discussions in languages that are not my native language. It is really hard to do well sometimes. FYI.
ESL=English as a Second Language.
So please try to work out definitions clearly, first. Thanks.
Thanks to @.Scott for trying.
This thread has some good content!
Good idea. I've been too stuck on details, I think.jim mcnamara said:I'm going to stay out of this. But there are definition issues. Clear debate requires that every use the same terms with exactly the same meaning. Can we agree on meanings?
Most people think assembly is speedy than high level languages. But I'm telling if high level language is configured more intelligently, it may be faster than assembler. Speed is majorly dependent on algorithms. if you implement an algorithm time cost as W(n) in assembly code (supposed as faster) a high level language (basic or any interpreted) implement algorithm time cost as W(log n) your assembly programs will breath the dust of the high level language implementation.phinds said:The original question as about the speed difference between assembly language (~ machine code) vs high level languages. Are there still open questions about that?
Well, of course. No one in this thread is claiming that a slow algorithm coded in assembly will run faster than a faster algorithm coded in a higher-level language.TMT said:Most people think assembly is speedy than high level languages. But I'm telling if high level language is configured more intelligently, it may be faster than assembler. Speed is majorly dependent on algorithms.
TMT said:if you implement an algorithm time cost as W(n) in assembly code (supposed as faster) a high level language (basic or any interpreted) implement algorithm time cost as W(log n) your assembly programs will breath the dust of the high level language implementation.
Also the intelligence embedded in high level language may generate speeder code. since embedded algorithm may create more optimized code than human can create.
As Mark pointed out, you have set up a dummy straw man argument and then shown that it's wrong. Your point is valid but really is irrelevant to this thread.TMT said:Most people think assembly is speedy than high level languages. But I'm telling if high level language is configured more intelligently, it may be faster than assembler. Speed is majorly dependent on algorithms.
Think on a case a machine having 16 register (as IBM), In program; you branch into a subroutine, you will going to save registers before starting subroutine and restore them before return back to caller Tel me how many programmer could count and mark which registers are altered in subroutine and write code to save and restore only those register. (register saving & restoring time cost is depend on # of register involved) But if your H_L compiler has an intelligence to consider this code will save & restore only altered registers process and optimize code accordingly. Please take this simple example as only to express my intention Since we can embed some logic in compiler we can let compiler will generate more optimal code than human can. (especially if you accept all programmer will not be smart as a versed one) in H_L compiler you even preprocess written code and localize some part as optimizable and apply specific process to optimize code generation. You can not train all your staff as versed assembler programmer. But you can use a high quality (optimization intelligence embedded) H_L language compiler to produce faster code.phinds said:As Mark pointed out, you have set up a dummy straw man argument and then shown that it's wrong. Your point is valid but really is irrelevant to this thread.