News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

is there some assembler for IA32?

Started by houyunqing, December 28, 2009, 06:47:50 PM

Previous topic - Next topic

houyunqing

I tried to determine which one was faster... and I tested with MASM/C++/Fortran/C#.NET, basically just through some repetitive arithmetic operations. It turned out that Fortran wasn't nearly as fast as some boasted, and MASM lost to C#.NET. So I was amazed. Shouldn't assembly be the fastest? There was no optimization in the C# compiler, but it did ran faster than MASM. And I guess it might be related to the IA32 framework? Aafter all MASM is such an old thing now... Is there an assembler for IA32 somewhere? or just some recently made assemblers for me to give some try?

jj2007

Quote from: houyunqing on December 28, 2009, 06:47:50 PM
Shouldn't assembly be the fastest?

Very bad assembly can actually be slower than C. Post your code if you want answers.

dedndave

well - any compiler eventually cranks out machine code, which can be written with assembler
some compilers may use advanced optimization techniques
but, there shouldn't be anything that can't be understood, learned, and applied in assembler
as JJ says - post the code
if the assembler code was slower, there is a reason for it

brethren

Quote from: houyunqing on December 28, 2009, 06:47:50 PM
I tried to determine which one was faster... and I tested with MASM/C++/Fortran/C#.NET, basically just through some repetitive arithmetic operations. It turned out that Fortran wasn't nearly as fast as some boasted, and MASM lost to C#.NET. So I was amazed. Shouldn't assembly be the fastest? There was no optimization in the C# compiler, but it did ran faster than MASM. And I guess it might be related to the IA32 framework? Aafter all MASM is such an old thing now... Is there an assembler for IA32 somewhere? or just some recently made assemblers for me to give some try?

c# compiles into bytecode that runs on a virtual machine, there is no way it could be faster than handcrafted asm

dedndave

Quotec# compiles into bytecode that runs on a virtual machine, there is no way it could be faster than handcrafted asm

huh ?   :eek

Farabi

Quote from: houyunqing on December 28, 2009, 06:47:50 PM
I tried to determine which one was faster... and I tested with MASM/C++/Fortran/C#.NET, basically just through some repetitive arithmetic operations. It turned out that Fortran wasn't nearly as fast as some boasted, and MASM lost to C#.NET. So I was amazed. Shouldn't assembly be the fastest? There was no optimization in the C# compiler, but it did ran faster than MASM. And I guess it might be related to the IA32 framework? Aafter all MASM is such an old thing now... Is there an assembler for IA32 somewhere? or just some recently made assemblers for me to give some try?

Well, C# might use the optimized function one and your ASM code might use only FPU.
I bet this code is faster on any C compiler.


C:
main ()
{ float x ;
x=2/2 ;
}

ASM:

Main:
mov eax,2
shr eax,1
ret



:green Okay, we are cheating.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

houyunqing

C# is supposed to be slow? I don't think so... from my own test C# was a hell lot faster than C++ and according to another test done by some guy using fourier transform, unoptimized C# was faster than even optimized C++ code. It's here: http://www.grimes.demon.co.uk/dotnet/man_unman.htm. As for the code I used... the test was done actually quite a few months ago... I can't find it now... i will test again and post the code here...
update:I've found my Fortran, C++ and C# code... now looking for my ASM code...

MichaelW

In your previous thread you were testing code where the calculations and the loop could be replaced with a single compile-time calculation, without affecting the result. If a Microsoft C/C++ compiler can recognize and remove useless code, why not a C# compiler? AFAIK Sun worked very hard to get the performance of Java up to a reasonable level. Why wouldn't Microsoft do the same? Try testing something where all of the code is essential to producing the desired result.
eschew obfuscation

Ficko

#8
Quote
I tried to determine which one was faster... and I tested with MASM/C++/Fortran/C#.NET, basically just through some repetitive arithmetic operations. It turned out that Fortran wasn't nearly as fast as some boasted, and MASM lost to C#.NET. So I was amazed. Shouldn't assembly be the fastest? There was no optimization in the C# compiler, but it did ran faster than MASM. And I guess it might be related to the IA32 framework? Aafter all MASM is such an old thing now... Is there an assembler for IA32 somewhere? or just some recently made assemblers for me to give some try?
Reading your "logic" I think you have some big holes in your basic education about computer science. :bg
Look up such things as "machine code", "native code", "bytecode", "assembler", "CPU", "JIT".
Quote
"Aafter all MASM is such an old thing now..."
It doesn't matter how old an assembler is.
You can take an assembler from the 80'es running it on a computer from the 80's and if you are a smart programmer you can beat C# easily by comparing average run time.
C# is a front end for a "JIT".
This means it has to compile your code before it can run it.
Lot of people call "JIT" being an interpreter because it is actually more close to an interpreter as to a compiler and a lot of things that applies for an interpreter which makes them slow applies to a "JIT" as well.
Even if your precompiled assembly cash is huge it has to go through a lot of dependency adjustment etc.

Quote
"Is there an assembler for IA32 somewhere?"
I do not know what you mean by that but if you are being a masochist you can try "ILasm". :toothy

rags

Ficko I think he's a bit confused about the names and thinks IA32 is something different
from x86.
God made Man, but the monkey applied the glue -DEVO

houyunqing

ah... thanks guys i found my ASM code and realized i was just wasting your time... ASM is indeed the fastest... sorry... haven't been dealing with those stuffs and forgot quite a lot. 

brethren

Quote from: dedndave on December 28, 2009, 10:58:05 PM
Quotec# compiles into bytecode that runs on a virtual machine, there is no way it could be faster than handcrafted asm

huh ?   :eek

http://en.wikipedia.org/wiki/Common_Intermediate_Language

dedndave


GregL


redskull

Quote from: dedndave on December 29, 2009, 04:43:02 PM
that applies to .NET

C#, VB.NET, and J# are all essentially the same language (.NET); each is a different syntax that produces the same intermediate code (CLI), which executes in a VM similar to Java.  They are, in every respect, all the same language

http://en.wikipedia.org/wiki/File:Overview_of_the_Common_Language_Infrastructure.svg

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government