flat assembler
Message board for the users of flat assembler.

Index > Main > Optimization

Author
Thread Post new topic Reply to topic
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
Hi,
Is it possible to specify a grade of optimization in FASM, as NASM does? (http://www.nasm.us/doc/nasmdoc2.html#section-2.1.22). Or all this is done automatically?

Thanks!

PD: An other thing. I found in a post that FASM 2 (if done) would be probably slower than the current one. SLOWER means assembling, right? Not the binary code resulting from a compilation.

Thanks Smile
Post 17 Apr 2011, 11:46
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17350
Location: In your JS exploiting you and your system
revolution
farresito wrote:
Is it possible to specify a grade of optimization in FASM ...?
Not natively.

There are a few macros around here that can "improve" encoding for things like LEA and TEST.
farresito wrote:
I found in a post that FASM 2 (if done) would be probably slower than the current one. SLOWER means assembling, right?
Yes. Your code is still your code, fasm won't mess with the output.
Post 17 Apr 2011, 11:48
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

My god, the day Fasm changes my code... I shudder to think!,
i throw it in the bin.

Very Happy

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 17 Apr 2011, 15:39
View user's profile Send private message Send e-mail Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville
revolution wrote:
Your code is still your code, fasm won't mess with the output.
Although let's not forget that assemblers often have encoding options that can produce shorter or longer code, and that code consequently may run faster or slower, albeit slightly. There is not a 100% 1:1 correspondence between assembly language mnemonics and machine code.
PS. Did I really meet you a couple of weeks ago, or was it just your hologram Question

_________________
FAMOS - the first memory operating system
Post 17 Apr 2011, 20:18
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17350
Location: In your JS exploiting you and your system
revolution
neville wrote:
Although let's not forget that assemblers often have encoding options that can produce shorter or longer code, and that code consequently may run faster or slower, albeit slightly. There is not a 100% 1:1 correspondence between assembly language mnemonics and machine code.
fasm2 may change that.
neville wrote:
PS. Did I really meet you a couple of weeks ago, or was it just your hologram Question
The problem with holograms is that there can be more than one. It is hard to keep track of things happening simultaneously in multiple places. So the answer is: maybe. Vagueness and non-answers are my speciality. I should be a politician. Razz
Post 17 Apr 2011, 23:56
View user's profile Send private message Visit poster's website Reply with quote
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
Thanks guys for your anwsers.

Quote:
fasm2 may change that


In FASM 2, the performance will be better? So code might be better optimized?

Thanks!
Post 18 Apr 2011, 15:12
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17350
Location: In your JS exploiting you and your system
revolution
farresito wrote:
In FASM 2, the performance will be better? So code might be better optimized!
Probably not. Just some new tools/ways to control code generation.

Also, be careful when you simply say optimisation. There is no simple metric that can cover it. In the general case there is no standard workstation/PC/platform that can be used as a benchmark to give consistent comparative measurements. Everyone has a different idea about what it optimised, and everyone has a different way to test for it.
Post 18 Apr 2011, 15:20
View user's profile Send private message Visit poster's website Reply with quote
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
FASM is multipassing processor, right? So it (almost) always tries to make the jumps as short as possible? Thats what I mean for optimization. To try to make the fastest code possible reducing the jumps.

Well, thanks another time. I dont want to be tiring but I dont know why I always have dubts with which assembler to use, although most of the people around the forums recommend FASM. Im a little bit concerned in the code optimisation.
Post 21 Apr 2011, 13:17
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17350
Location: In your JS exploiting you and your system
revolution
farresito wrote:
FASM is multipassing processor, right? So it (almost) always tries to make the jumps as short as possible? Thats what I mean for optimization. To try to make the fastest code possible reducing the jumps.
Correct[1]. But it is more than just jumps, also constant encoding and some other stuff.

But your query seems to be about code size reduction, which you are calling optimisation[1]. If this is correct then, yes, fasm presently does optimise your code size. fasm2 will also most probably optimise the code just the same, but with some extra features to do a few more fancy things. The code functionality will still be the same though.

[1] Note that jump size reduction is not a proxy for fast code. It is not as simple as that. Try not to confuse small code size with fast execution, they are not the same thing.
Post 21 Apr 2011, 13:22
View user's profile Send private message Visit poster's website Reply with quote
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
Thanks revolution.

Ok, it was a little bit of all. I thought that making jumps smaller would also increase code execution considerably, so It has been confusing. Now its clearer.

Regards!

PD: So the execution speed of the same code assembled in various assemblers would be (mostly) the same right?

PDPD: Will be Fasm 2 definetely made? I red in a post that maybe Tomas would not make it.

Thanks a lot for helping me. Its just awesome Smile
Post 22 Apr 2011, 09:51
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17350
Location: In your JS exploiting you and your system
revolution
farresito wrote:
PD: So the execution speed of the same code assembled in various assemblers would be (mostly) the same right?
Yes. For most regular programs you'd never notice any difference.
farresito wrote:
PDPD: Will be Fasm 2 definetely made? I red in a post that maybe Tomas would not make it.
Tomasz, are you listening?

fasm2 might, or might not, happen. Just use the existing fasm until such time as a new version arrives.
Post 22 Apr 2011, 09:59
View user's profile Send private message Visit poster's website Reply with quote
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
Thanks a lot revolution Smile

I really appreciate your support. Thanks for taking your time replying my questions.

Regards!
Post 22 Apr 2011, 10:26
View user's profile Send private message 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. Also on YouTube, Twitter.

Website powered by rwasa.