Advertisement

Assembly : When is it worth your time?

Started by May 25, 2004 02:57 PM
101 comments, last by OpenGL_Guru 20 years, 5 months ago
i have been reading many threads lately and assembly just was brought up in a previous thread that i started. since i dont program in assembly, only when i was in college, i was wondering who uses assembly and you if you do, is it really worth your time. i guess the next question is -- is when will it NOT be worth your time? we are looking at projected 5 - 7 Ghz machines in the next few years and about 10 Ghz machines not too long after that. yes with assembly you dont have to worry about buses and transferring data back and forth but when the CPU gets this fast is it really worth your while to save a few CPU cycles? i dont mean to rant against assembly , its lightning fast but was sincerely wondering when it will totally be useless or do you see it as something we will always need?(at a development level)
heh
Assembly is only worth it to access features of a cpu that your compiler dont currently support (SEE2 for example) or when you have a bottleneck and have done just about everything else possible. Mainly because unless you are an expert you will most likely write worse assembly code than the compiler would''ve done anyway.
Advertisement
OpenGL_Guru, you forgot to consider that as CPU''s become faster and faster, games will also start using new computation heavy features that were not possible before thus the games will also become more CPU power demanding.

So bascially you will be using assembly to optimize parts of those new computation heavy features so they can fit the power of the new CPU''s.

Hell I am not an expert. We''ll just wait and see.
For modern GPUs with their complex architecture, deep pipelines, branch prediction, conditional execution, parallelism etc. it is very hard to hand-code better assembly code than a good optimizing compiler will produce, whos optimizer has been built by people doing nothing but examine the target CPUs workings and squeeze every ns from the resulting code, and who have a lot of theory and tools at hand for this.

A simple example: On a modern CPU, it can be advantageous to chose a slower instruction for a certain operation to allow for parallelizing some code and avoid pipeline stalls. Few people have such intimate knowledge of the CPU''s they''re coding for workings.

I had been hand-coding critical parts of my applications in assembly language myself and had given up years ago when what the compiler produced was about 10% faster than my code ...
_________karx11erxVisit my Descent site or see my case mod.
yes but i think CPUs are growing at a bigger rate than the current games that are available. take a look at doom 3. whats the system requirements are for maximum performance--about 1.8 Ghz maybe less with a few things tweaked down. the minimum requirements are about 1 Ghz but i am sure this is at the lowest settings. so for a game that isnt even out yet 1.8 Ghz and 256 - 512 Mb RAM - depending on OS hunger, and we are sitting at 3.4 Ghz now, i myself have a 3.2 and 2 GB of RAM. and remember games like DOom 3 and Half Life 2 are the newest and brightest games -- not every game will require this much power.. and again they arent even out yet. right now i guess my point is is that the processor speed is getting ahead of even the latest games out there. maybe this will change i dunno.

--and you are right -- GPU's are getting more sophisticated, taking even more off the CPU than ever before and will continue to do so.. so the basis of this thread ill ask the question again --

when will it NOT be worth anyone's time to even fathom of doing any assembly code? is the time drawing nigh?

[edited by - opengl_guru on May 26, 2004 9:43:08 AM]
heh
I think it will always be worth when it comes to CPU instructions that might be compiled in a less effective (fast) way than you can. I don't see rapidly increasing CPU speeds as a way to make real-time programming easier, but only to make it look better and make physics and such more realistic. I think highly ajustable quality options are the way to go, this way you can get the most out of the fast CPUs and still run the game/program without needing one.
I think whenever you have the spare time and it might speed up even the least bit ASM is worth your time.
EDIT:typo

[edited by - Tree Penguin on May 26, 2004 10:37:50 AM]
Advertisement
It''s worth your time, when you are very good at it and writing a operating system.

I would never touch it when it comes time to make a application/game.
Does anybody know a page with tutorial on 3DNow! (beside AMD) that uses intel syntax (preferd)


P.S.
Sory about gramatcal errors
Red Drake
Sorry but I will have to disagree with some of what has been said in this thread. There is no computer currently available to the public right now that could POSSIBLY run Sim City 4 on max settings in a large city But yes unless the assembly code is for some extremely esoteric topic, leave it to the compiler.
My fellow Americans I have just signed legislation that outlaws Russia forever. Bombing will commence in five minutes.
I would really disagree that a compiler can produce equal or better ASM code, compared to a good ASM programmer.

This topic is closed to new replies.

Advertisement