🔒 Locked
Assembly code vs C/C++
Advertisement
Original Post
I started laughing once I saw the title.. Of course if you''d like to learn ASM, it''d be useful in game programming to speed some uneffecient algos if there''s no other way out... if you know how to work out everything in ASM, you''ll be able to speed your code up quite a bit.,.. but it takes a while to learn ASM... and a pretty long time to master it...
Today, the algorithm is more important than its implementation. When you have a good engine and a bad engine. Then you recode the bad engine in ASM. The good one will still be faster...
A bubble sort in ASM is slower than a quicksort is C++. And a buggy, crappy engine like Ultima9 wouldn''t run mouch faster in ASM. I don''t think that doing something in ASM makes a big difference... unless you want to write a device driver ;-)
Tim
--------------------------
www.gamedev.net/hosted/glvelocity
glvelocity.gamedev.net
www.glvelocity.com
A bubble sort in ASM is slower than a quicksort is C++. And a buggy, crappy engine like Ultima9 wouldn''t run mouch faster in ASM. I don''t think that doing something in ASM makes a big difference... unless you want to write a device driver ;-)
Tim
--------------------------
www.gamedev.net/hosted/glvelocity
glvelocity.gamedev.net
www.glvelocity.com
Well, I would suggest that you at least try it out. Go through some examples in the book and get an understanding of what registers and operations there are. You might try and implement some C/C++ functions with inline assembly, to get the hang of that. Then, if you''re ever in a pinch for speed, you''ll be at a good starting point.
It''s true though, assembly is no trivial thing to master and takes a lot of practice/coding. I think you''ll be much better off learning how to use it when necessary and sticking to the "application" instructions -- you don''t need to get into all the instructions for memory management (TLB''s, etc), security descriptors, etc.. Stick with the basics.. at least in the beginning.. moving, shifting, comparing, add/mul/div, loops, jumps, etc..
// CHRIS
It''s true though, assembly is no trivial thing to master and takes a lot of practice/coding. I think you''ll be much better off learning how to use it when necessary and sticking to the "application" instructions -- you don''t need to get into all the instructions for memory management (TLB''s, etc), security descriptors, etc.. Stick with the basics.. at least in the beginning.. moving, shifting, comparing, add/mul/div, loops, jumps, etc..
// CHRIS
well I started with c/c++ my self and about a year ago I started learning assembly... even when I have no plans for using assembly in a pice of code the knowlogo gained from my understanding of assembly has help an ungoddly amount... knowing roughly what is being done on the assembly level help alot in know if a pice of code is going to be fast or slow...(it might help to think that c/c++ compilers trancelate the code into assembly then compiles the assembly code... not realy how it works but until you know more it might help =)
also there are about 3-4 places in my current project where I''ve seen no way around using inline assembly to code it... so it does come in handy like that every now and then...
yes assembly... properly place can work wonders on speed if you know how and where to put it... theres some articals on here explainning the basics of this when your ready....
make no mistake about it... assembly is a bear to learn but after you get the basics it starts to go alot easier....
tcs: I don''t think that doing something in ASM makes a big difference... unless you want to write a device driver ;-)
and in writing your own operating system too =P
anyways good luck,
Great Milenko
also there are about 3-4 places in my current project where I''ve seen no way around using inline assembly to code it... so it does come in handy like that every now and then...
yes assembly... properly place can work wonders on speed if you know how and where to put it... theres some articals on here explainning the basics of this when your ready....
make no mistake about it... assembly is a bear to learn but after you get the basics it starts to go alot easier....
tcs: I don''t think that doing something in ASM makes a big difference... unless you want to write a device driver ;-)
and in writing your own operating system too =P
anyways good luck,
Great Milenko
Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."
http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement