i find it rather amusing when people claim that they can optimize their code better than a high end compiler on a consistent basis. here's some food for thought: i've been programming in x86 assembly for oh, probably 8 or 9 years. code and algorithm optimization happens to be one of my specialties. yet, there's absolutely no way i could guarantee that i could produce faster code for any given task than, say, intel c++ 4.5 or msvc++ 6.0.
some more food for thought - faster code does not mean faster execution times. you can walk across a field faster than you could run a lap around it. the execution speed is dictated first and foremost by the algorithm you use. then by the implementation details (common sense stuff, don't reference an array inside a loop when you can increase the array pointer instead, don't divide by the same value twice when you can divide by the reciprocal, etc). then, if you still need to squeeze more speed out of it, you might get a 5% speed increase by hand optimizing the inner loops.
do the math, figure out the priorities .
-goltrpoat
--
Float like a butterfly, bite like a crocodile.
Edited by - goltrpoat on May 19, 2000 4:12:33 AM
Why not assembly?
oh, some of you might remember Into The Shadows by Triton. the game looked pretty good, or at least the demo did, and Triton was widely publicising the fact that the game was being written in 100% assembly.
i don't think it ever made it past the first public demo.
-goltrpoat
--
Float like a butterfly, bite like a crocodile.
Edited by - goltrpoat on May 19, 2000 4:16:25 AM
i don't think it ever made it past the first public demo.
-goltrpoat
--
Float like a butterfly, bite like a crocodile.
Edited by - goltrpoat on May 19, 2000 4:16:25 AM
--Float like a butterfly, bite like a crocodile.
I use assembler for functions in my code that needs to run fast, and I think it''s best to combine the compiler with pieces of assembler code.
Things like screenfading (color substraction) and alpha-blending can be better done in assembler.
Sludge Software
www.sludgesoft.com
Developing a secret of mana style role-playing-game
Things like screenfading (color substraction) and alpha-blending can be better done in assembler.
Sludge Software
www.sludgesoft.com
Developing a secret of mana style role-playing-game
Sludge Softwarewww.sludgesoft.comDeveloping a secret of mana style role-playing-game
C and particulary C++ lend themselves to large complex systems...systems that just would be insanely difficult to do entirely in ASM. Handwritten ASM can be fast, no doubt, but is it worth it to spend all the hours and hours on systems that could have been created in far less time in C/C++?
Sieggy
Sieggy
I think the answer has to be: strike a happy medium. I''d like to see you program a fully functional windows program purely in assembly, I really would. There is a reason people have moved beyond the bit-level.
Why don''t people write in assembly anymore. Because they can do programs that are far larger, easier to debug, less likely to screw with the OS (safer), more structurally sound, MUCH more portable, more reusable, and more readable. Can you do things "faster" with assembly? Yes. There''s no question... you could just say "screw the run-time stack and the heap, I''ll just assign memory in my own way, which is suited to this program and not mess around with that at every function call". But that''s ridiculous. My advice? If you''re really into speedy, optimized code, write in C or C++, and then disassemble the machine code, and modify it in assembly. I think it''s a fair compromise. But that''s just my two cents.
random-nomad
Why don''t people write in assembly anymore. Because they can do programs that are far larger, easier to debug, less likely to screw with the OS (safer), more structurally sound, MUCH more portable, more reusable, and more readable. Can you do things "faster" with assembly? Yes. There''s no question... you could just say "screw the run-time stack and the heap, I''ll just assign memory in my own way, which is suited to this program and not mess around with that at every function call". But that''s ridiculous. My advice? If you''re really into speedy, optimized code, write in C or C++, and then disassemble the machine code, and modify it in assembly. I think it''s a fair compromise. But that''s just my two cents.
while( strcmp(reply,flame) ) followThread();
random-nomad
May 20, 2000 10:40 PM
After programming in ASM for two years now, some things are much easier in ASM. For the most part, write in C++ then write whatever you need in ASM
I''m biased towards ASM though. I think its more fun and I learned it before C++
I''m biased towards ASM though. I think its more fun and I learned it before C++
quote: Original post by CGameProgrammer
I wrote a triangle renderer in C++ and achieved a modest framerate. I then wrote it in Assembly, making use of pairing, limiting the number of conditional jumps executed, and making efficient use of registers, and the framerate has improved by around 12%. And I haven''t even used MMX yet -- I could improve framerate even further using it.
It''s fine to use Assembly in functions that require high speed, but it takes a while to develop and debug.
~CGameProgrammer( );
...And if you used C/C++ and DirectX/OpenGl and the 3D graphics card you probably have, the gain would be ?...
Assembler has the possibility to do some optimizations, but the truth is that speed issues are being more and more addressed by specific hardware.
I think that it''s getting to the point that the time you spend optimizing things in assembler might be better spent improving other aspects of your game than speed.
the question you should be asking is "why assembler?"
All ASM is used for nowadays is low-level drivers and the gritty bits of OS production.
/home/./~jumble
---------------
All ASM is used for nowadays is low-level drivers and the gritty bits of OS production.
/home/./~jumble
---------------
jumble-----------
Not to be rude, but as I''m reading over this thread, I''m seeing everyone say almost exactly the same thing over and over and over again Kinda funny.
Jonathan
Jonathan
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement