flat assembler
Message board for the users of flat assembler.

Index > Main > how can i test performance

Author
Thread Post new topic Reply to topic
maslan



Joined: 08 Sep 2003
Posts: 54
maslan
hi guys
if i've 2 pieces of diff. code which do the same perpose how can i test the performance of each to know which one works faster and so on like that :
the 1st i wrote
Code:
SYS_PRINT:              ; ESI:STRING OFFSET
        MOV     EBX, 00000001h
        MOV     ECX, ESI
        PRINT_LOOP:
        MOV     AL, [ECX]
        OR      AL, AL
        JZ      PRINT_END
        MOV     EAX, 00000004h
        MOV     EDX, 00000001h
        INT     80h
        INC     ECX
        JMP     PRINT_LOOP
        PRINT_END:
        MOV     ESI, ECX
        RET             
    

and the other one taken from fasm source
Code:
SYS_PRINT:              ; ESI:STRING OFFSET
        MOV     EDI,ESI
        MOV     EDX,ESI
        OR      ECX,-1
        XOR     AL,AL
        REPNE   SCASB
        NEG     ECX
        SUB     ECX,2
        MOV     EAX,4
        MOV     EBX,1
        XCHG    ECX,EDX
        INT     80h
        RET               
    


when i compiled them the 1st is 38 bytes and the 2nd is 39 bytes
so i want to test the performance and the speed for this example Shocked

thanks

_________________
Maslan
I'm searching for perfection so, even if u need portability u 've to use Assembly
---
http://www.maslanlab.org
---
http://libosdk.berlios.de
http://maslanedit.sf.net
http://maslancms.sf.net
Post 08 Jul 2004, 11:13
View user's profile Send private message Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc
If you're running under Linux, use the 'time' program:

fasm program1.asm program1
chmod +x program1
time ./program1

And repeat for each modified version. It's best to time the program a couple of times and average the results. Seriously though, performance of output isn't the easiest thing to optomize anyway: you're bound by the kernel's internal routines!
Post 08 Jul 2004, 11:40
View user's profile Send private message Visit poster's website Reply with quote
maslan



Joined: 08 Sep 2003
Posts: 54
maslan
Very Happy
ya sure i use linux & also freebsd and minix
i heard about time command may be when building linux from scratch

but i've 2 computers , so i think i will test it on both machines for more accurate results (p3 450M,p4 2.6G)

thanks for ur quick reply Razz

_________________
Maslan
I'm searching for perfection so, even if u need portability u 've to use Assembly
---
http://www.maslanlab.org
---
http://libosdk.berlios.de
http://maslanedit.sf.net
http://maslancms.sf.net
Post 08 Jul 2004, 12:05
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo
Hi Maslan,

Have you tested the methods shown on the following thread? http://board.flatassembler.net/topic.php?t=496
Post 08 Jul 2004, 12:43
View user's profile Send private message Yahoo Messenger Reply with quote
fasm9



Joined: 19 Jun 2003
Posts: 439
fasm9
OProfile - A System Profiler for Linux
http://oprofile.sf.net

BTW, whatever you want in Linux, it is in Kernel! so need kernel-compile.

debian:/usr/src/linux-2.6.7#make menuconfig

enable Oprofiler, if you want kernel hacking with FASM, also, enable Kernel hacking option.

http://kerneltrap.org
--
bk20+ck4(staircase 7.9)+fusion-full-linux 2.6.3
Post 09 Jul 2004, 00:40
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.

Powered by rwasa.