flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
vid 05 May 2004, 08:21
1. you meant 5-25% faster than written in ASM?
2. somewhat yes, but not noticeably. In such app most of time is usually spent in DX/OGL. But when using DX you can make your own routines for some operations (ram -> ram) which are faster than DX's |
|||
![]() |
|
Embrance 05 May 2004, 15:45
1)sorry misatake i mean ASM faster than C
|
|||
![]() |
|
decard 05 May 2004, 16:01
It is difficult to say that "asm code will be XX% faster than C code". It depends, mostly on the probrammers' skills, and on the way C compiler optimizes the code. For example some time ago Intel developed super-optimizing C compiler. However, assembly programmers with some experience are still writing faster code than even most optimized compilers. And proably this situation won't change soon - you can always write better optimized assembly code, just because... you are the human
![]() ![]() |
|||
![]() |
|
Embrance 06 May 2004, 16:08
But since ASM is the next closer thing to a pc true langueage,i assume that it would be faster.Even if 1%,but it would be.,
|
|||
![]() |
|
roticv 06 May 2004, 16:37
A bad asm code will perform worse than codes produced by a good C compiler.
|
|||
![]() |
|
ShortCoder 07 May 2004, 04:31
You can also code in C, compile, disassemble the resulting executable, then try to optimize the assembly code that you see (assuming you can figure out what it is doing)
Using gcc with -O3 (best optimization) on a simple program I was making, I looked at the disassembled output from the executable, and found that, at one point, there was a call into a function which, all it did was save the stack, finit, restore the stack and return. Why finit wasn't assembled inline with the calling procedure, I'll never know. Seems like an awful lot of unnecessary overhead to me, though. |
|||
![]() |
|
vid 07 May 2004, 19:37
Quote:
in special cases (like the one you mentioned) yes, but this job can usualy be as well done by compiler. In my opinion, speed of assembly code is usualy acheived by coding it "assembly style", slightly another way than you would code it in C (other structure of code). |
|||
![]() |
|
madmatt 07 May 2004, 20:45
In C and c++, all of the arguments are pushed onto the stack, and has to be retrieved from the stack(memory) which is slower. In assembly you can use registers for looping, and you can use the special addressing modes and instructions (mmx,sse/sse2) easily (at least with fasm for windows) for increased performance (like when retrieving/storing/manipulating arrays of data).
|
|||
![]() |
|
Embrance 08 May 2004, 05:20
OK.Thanks for youyr time.
|
|||
![]() |
|
vid 08 May 2004, 17:40
madmatt: doesn't optimizing compiler unroll simple functions and remove stdcall style from procedures that can receive arguments in register? I never looked deeply at optimization of C/C++ compilers, but i think this is quite easy-to-do optimization (store addr of every call of procedure, check each call for certain conditions, decide whether do optimization...). I think they should do those two optimizations.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.