flat assembler
Message board for the users of flat assembler.
Index
> Main > Some questions! |
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 |
|||
05 May 2004, 08:21 |
|
Embrance 05 May 2004, 15:45
1)sorry misatake i mean ASM faster than C
|
|||
05 May 2004, 15:45 |
|
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 , and computers still can't think the way we think
|
|||
05 May 2004, 16:01 |
|
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.,
|
|||
06 May 2004, 16:08 |
|
roticv 06 May 2004, 16:37
A bad asm code will perform worse than codes produced by a good C compiler.
|
|||
06 May 2004, 16:37 |
|
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. |
|||
07 May 2004, 04:31 |
|
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). |
|||
07 May 2004, 19:37 |
|
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).
|
|||
07 May 2004, 20:45 |
|
Embrance 08 May 2004, 05:20
OK.Thanks for youyr time.
|
|||
08 May 2004, 05:20 |
|
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.
|
|||
08 May 2004, 17:40 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.