flat assembler
Message board for the users of flat assembler.

Index > Main > Some questions!

Author
Thread Post new topic Reply to topic
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
Lets see this:
We have an OS thats kinda "heavy".
I suppose that if its writen in C only it would improve its speed by 5-25%in alll/some areas of it.

And:
An app that use ASM and directX/opengl would be faster thatn C and directx/opengl?
Post 05 May 2004, 04:23
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
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
Post 05 May 2004, 08:21
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
1)sorry misatake i mean ASM faster than C
Post 05 May 2004, 15:45
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
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 Wink, and computers still can't think the way we think Smile
Post 05 May 2004, 16:01
View user's profile Send private message Visit poster's website Reply with quote
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
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.,
Post 06 May 2004, 16:08
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
A bad asm code will perform worse than codes produced by a good C compiler.
Post 06 May 2004, 16:37
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
ShortCoder



Joined: 07 May 2004
Posts: 105
ShortCoder
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.
Post 07 May 2004, 04:31
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:

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)

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).
Post 07 May 2004, 19:37
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
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).
Post 07 May 2004, 20:45
View user's profile Send private message Reply with quote
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
OK.Thanks for youyr time.
Post 08 May 2004, 05:20
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
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.
Post 08 May 2004, 17:40
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.