Advertisement

VC++? Really?

Started by July 24, 2000 03:57 PM
38 comments, last by Gladiator 24 years, 4 months ago
push	edi ; saves the value for edi heremov	edi, DWORD PTR _mine$[esp]	; store address of "mine" arraymov	ecx, 9	   ; well, it has nine fields. note that this is not byte-aligned, so I wonder how to optimize itmov	eax, 255   ; the actual value we want to put into the fields. ''nuff said.			rep stosd	   ; now repeat storing eax'' value into DWORD PTR _mine$[esp+ecx] until ecx eq. zeropop	edi        ; restore edi value   



mmm, I''m really not into ASM, but isn''t there another equal length reg like edi in the processor where you could store the edi value instead of pushing it and popping it out of memory?
Alright alright... calm down people... daammn... I had a good laugh.. you maybe ARE a comedian after all.. maybe not THAT good but you are.. haha

quote:
I''ve said all that I''m gonna say... I''ve wasted enough of my life with this post. Damn, Gladiator... I guess I am a bitch, you got me to respond to your post. I DO love people who talk mad shit behind the security of a computer. You are truly the shit, man. Can we be friends?

hah... you think im the kind of person talking shit while hiding behind the wall? damn man.. i wouldve tolda all the shit i think about you even if we were to meet.. that''s if i have got anything to say... but you seem like a nice guy...

quote:
No one ever said he was an idiot.

Of course not... if the anonymous gal at least knew what an idiot meant then SHE would''ve figured out i wasnt an idiot at all... but that''s the only word SHE knows so.. im not gonna be too hard on her...

quote:
I think the point would be to be very carful before you criticize. Then again, maybe I should stick to my own advice. Accept my apology Gladiatior... I don''t want this shit getting out of hand and would much rather make a friend than an enemy.
[/quote
that''s alright with me... if you wanna be friends, cool.. if you wanna keep laughing at each other''s useless posts for a long time, that''s fine by me


Of course, the smart thing to do would be to piss you off, then let you see my code and nitpick it to death… Optimization for free

heh.. i gotta piss you off twice as much before i do it for you

quote:
push edi ; saves the value for edi here

mov edi, DWORD PTR _mine$[esp] ; store address of "mine" array
mov ecx, 9 ; well, it has nine fields. note that this is not byte-aligned, so I wonder how to optimize it
mov eax, 255 ; the actual value we want to put into the fields. ''nuff said.
rep stosd ; now repeat storing eax'' value into DWORD PTR _mine$[esp+ecx] until ecx eq. zero
pop edi ; restore edi value


I can think of one SMALL optimization right now, but then again, I''m not THAT good at ASM… I''m learning as time passes by…

btw, what in the world is ROFLMAO? … on the floor laughing…



——————————-
That's just my 200 bucks' worth!

..-=gLaDiAtOr=-..
Advertisement
quote: Original post by alexmoura

push	edi ; saves the value for edi heremov	edi, DWORD PTR _mine$[esp]	; store address of "mine" arraymov	ecx, 9	   ; well, it has nine fields. note that this is not byte-aligned, so I wonder how to optimize itmov	eax, 255   ; the actual value we want to put into the fields. ''nuff said.			rep stosd	   ; now repeat storing eax'' value into DWORD PTR _mine$[esp+ecx] until ecx eq. zeropop	edi        ; restore edi value    



mmm, I''m really not into ASM, but isn''t there another equal length reg like edi in the processor where you could store the edi value instead of pushing it and popping it out of memory?


Hi all.

How about this one:

    xor	eax,eaxmov	edx,edinot	al	; the actual value we want to put into the mov	edi, DWORD PTR _mine$[esp]	; store address mov	ecx, 9	   ; well, it has nine fields. note that this is rep stosd	   ; now repeat storing eax'' value into DWORD PTR _mine$[esp+ecx] until ecx eq. zeromov	edi,edx    


Topgoro

We emphasize "gotoless" programming in this company, so constructs like "goto hell" are strictly forbidden.
ROFLMAO = rolling on floor laughing my ass off.

-BacksideSnap-
Thanks!

I imagine you doing that =)

-------------------------------
That's just my 200 bucks' worth!

..-=gLaDiAtOr=-..
I think, this one is the best:

    mov  edx,  DWORD PTR _mine$[esp] ; store addressmov  eax, 255 ; the actual value we want to put into the fieldsmov [edx+00], eaxmov [edx+04], eaxmov [edx+08], eaxmov [edx+12], eaxmov [edx+16], eaxmov [edx+20], eaxmov [edx+24], eaxmov [edx+28], eaxmov [edx+32], eax    

Loop unrolling eliminates the setup overhead of REP instruction (it can be 10-15 cycles).
Advertisement
Gladitor & BacksideSnap: Did I mention any names? Did I somehow manage to point out that was directed to Gladitor? I don''t believe so. Truthfully that could have been directed at anybody or even everybody. I''ll clarify in a moment...

Gladitor: Idiot is the only word I know? OK then touche''. Perhaps I should have stated a fool so there wasn''t a misunderstanding. It''s my belief that the average age user of this board is about 15 and it is also my belief that they get the just of what I mean by idiot... Something else I do know is that anytime an ego is involved it''s apparent that there needs to be some growing up to do on someone''s part because at the base of that personality is a very immature mentality. Perhaps I should take this time to point out I''m not talking about you necessarily, but then again, maybe I shouldn''t...
BTW, is gal and SHE just your own special way of attempting to be tacky or do you automaticaly assume that females in general are unintelligent and unable to have wisdom?
Just a little curious on that one but no biggie.

I''ve helped more members of GDnet through this board and via e-mail than I can possibly remember. I''ve been corrected on very few occassions and can assure you I handled it much more gracefully than what I have seen in this thread when it has happened.

So before I feed into this too much more or just start an all out "territorial pissing contest" which looks as though it could be easy to do, my clarification:

...both sides, PRO/CON realize...

Make sure you understand that part of the statement...

You''re A Programmer, You Figure It Out


YAP-YFIO,
deadlinegrunt

~deadlinegrunt

quote:
Gladitor & BacksideSnap: Did I mention any names? Did I somehow manage to point out that was directed to Gladitor? I don''t believe so. Truthfully that could have been directed at anybody or even everybody. I''ll clarify in a moment...


You said boths sides, which includes me, and if somebody has a problem with me, i have to deal with it...


quote:
Gladitor: Idiot is the only word I know? OK then touche''. Perhaps I should have stated a fool so there wasn''t a misunderstanding. It''s my belief that the average age user of this board is about 15 and it is also my belief that they get the just of what I mean by idiot...

Idiot is not the appropriate word to be called... immature is not either... pissed or upset is the correct one.... i was upset at the time because of something that had happened to me. it''s okay now though...

quote:
Something else I do know is that anytime an ego is involved it''s apparent that there needs to be some growing up to do on someone''s part because at the base of that personality is a very immature mentality. Perhaps I should take this time to point out I''m not talking about you necessarily, but then again, maybe I
shouldn''t...

As I said... i may SEEM immature simply because i was upset about something... and i do get upset very often with thigns that happen in my life.. not because of stuff that happen on the net or specifically on gamedev...

quote:
BTW, is gal and SHE just your own special way of attempting to be tacky or do you automaticaly assume that females in general are unintelligent and unable to have wisdom?
Just a little curious on that one but no biggie.

you know BETTER than that... you would know what i was trying to convey...

quote:
I''ve helped more members of GDnet through this board and via e-mail than I can possibly remember. I''ve been corrected on very few occassions and can assure you I handled it much more gracefully
than what I have seen in this thread when it has happened.

Good for you!! Applause!

quote:
So before I feed into this too much more or just start an all out "territorial pissing contest" which looks as though it could be easy to do, my clarification:

...both sides, PRO/CON realize...

Make sure you understand that part of the statement...

You''re A Programmer, You Figure It Out

i do understand it... and ive explained already..

same as you i wouldnt like to be in any time of pissing contest as you put it. if you''d like to keep in touch and be friends, that''s all right, if you don''t just say so... anyways... whichever you choose, i would like to stop this arguing.. maybe next time i dont know something i wouldn''t post it here so i dont get flamed for it... and stay an idiot who''s less knowledgeable that other people... anyways.. take care!

-------------------------------
That's just my 200 bucks' worth!

..-=gLaDiAtOr=-..
quote: Original post by Serge K

I think, this one is the best:

            mov  edx,  DWORD PTR _mine$[esp] ; store addressmov  eax, 255 ; the actual value we want to put into the fieldsmov [edx+00], eaxmov [edx+04], eaxmov [edx+08], eaxmov [edx+12], eaxmov [edx+16], eaxmov [edx+20], eaxmov [edx+24], eaxmov [edx+28], eaxmov [edx+32], eax            

Loop unrolling eliminates the setup overhead of REP instruction (it can be 10-15 cycles).


k, you got me

pi~

Edited by - The_[PI]_ehT on July 28, 2000 9:15:21 AM
Jan PieczkowskiBrainwave Studios
I can''t resist an optimization challenge

This last bit of code is good, but if you use MMX you can cut memory accesses from 9 to 5, nearly doubling the effective speed of the code. I think this should work:

    mov eax, 255  ; load value in eaxmov edx, DWORD PTR _mine$[esp]  ; load destination addressmovd mm0, eax ; mov into mmx registerpunpckldq mm0, mm0 ; copy into high 32 bits of mmx registertest edx, 4  ; test to see if destination is 4-byte or 8-byte alignedjz alignqwordmov [edx], eax  ; 4-byte alignedmovq [edx+4], mm0movq [edx+12], mm0movq [edx+20], mm0movq [edx+28], mm0retalignqword:movq [edx], mm0 ; 8-byte alignedmovq [edx+8], mm0movq [edx+16], mm0movq [edx+24], mm0mov [edx+32], eaxret    


Of course, you have to remember to throw in an EMMS instruction before you can use normal floating-point code again. One thing I learned from Michael Abrash: There Ain''t No Such Thing As The Fastest Code. Modern compilers can generate very good code, but never the best code. Remember, the compiler only knows how to make generic optimizations. The best optimizer for your project is your own brain.

Note: I am not saying everything should be hand optimized, but for that critical 5% of the code, it may be just what your project needs.


- Democritus

* Truth is universal *

- Democritus * Truth is universal *

This topic is closed to new replies.

Advertisement