Advertisement

Why not assembly?

Started by May 18, 2000 05:41 PM
23 comments, last by Aztec 24 years, 6 months ago
why isn''t there more attention paid to programming in assembly language? it is faster, more efficient, and an all around better language. It would seem that more people would want to program in it......
Faster in execution perhaps, but not by much. Prgramming assembly takes longer and most people dont have a head for it. It''s a simple language but you have to do more work in your head like when you go to move variables around and do complex calculations. High level languages are easer to program because they look more like english than hiroglifs.

It would be nice if every one knew assembly, and used it throghout their code for speed. But writing whole programs in assembly is not worth the effort anymore.

OneEyeLessThanNone
just racking up some messages
Advertisement
faster : well maybe a little faster in execution (my experience says 5-10% over MS C/C++), but not in development

more efficient: uhh, no. How efficiently can you store/access a dynamic, 2 dimensional array of objects--and their member variables--with assembler?

all around better language: than what? Spanish? Let''s see you do this in assembly language in the 10 seconds it takes me to do it in C++:

class CSomething {
public:
CSomething() { x = 5; }
~CSomething() { if (next) delete next; }
int Move(int x) { y+=x; }
void CreateSomething() { next = new CSomething(); }

int x;
CSomething *next;
};

You aint gonna do it.
Some years ago coding assembly was the only way to create fast code. Today the motto seams to be: not fast enough - buy a new computer. At least that''s my opion.

Some time ago I only coded asm. Real hardcore programming with super speed (an elite sport - if I may say so?)

Now assembly it getting more disadvantages: Al the time new instructions are designed.
- 386 has less instructions than 486
- Pentium being even better.
- Floating point becomes fast.
- MMX does it''s entry
- 3D acceleration cards.
- ...what''s next?

The primairy reason for me to stop with assembly (now coding C/C++) was OPTIMIZATION!
Doing Pentium optimizations really fucks up the "nice" look of your code, and is hard!

Now I (try to) trust my compiler to generate super optimized code. Now I can forget all the "different assembly languages" (386/486/P5/FPU/MMX/...) and concentrate on coding something "usefull"...
Assembly is ''the best'' language because you can optimize the code better than you could do in any high-level language. But you need to much time to code whole programs in assembly. Another disadvantage is that it''s not portable, although most people write their programs for only one platform.

Visit our homepage: www.rarebyte.de.st

GA
Visit our homepage: www.rarebyte.de.stGA
I think one reason why ASM is used less by the average programmer is because the low level routines that access hardware directly and need to be super optimized are created my the hardware manufactures: "drivers".

I can''t see writing a game where my file loaders and game logic and everything is in ASM. I can see writing low level graphics, sound, etc. routines in ASM. But chances are I can use routines that someone else already wrote and not worry about it.

---
And as to optimization: not only is ASM platform-dependant, but if you optimize for current technology, you''ll have to optimize again for next generation technology. C/C++ may not create quite as fast code today, but not having to rewrite it all for the next thing (new SIMD in Wilamette, or 64-bit CPUs, etc.) to perform optimally is a plus.

Imagine that you coded an app optimized for 486 ASM... would that same ASM be faster or slower on your current system than C++ code recompiled with Pentium optimizations?

---
Yet another reason, you can write a pure ASM Windows app... but other than a smaller file size/memory footprint, how much do you gain when you are calling Windows API functions written in C all the time? And do people really care about size (disk space, memory use) that much anymore (the amount you you can save by using pure ASM)?

---
As for complexity: For a small project (small game maybe) using pure ASM might not be so bad. If you look at the latest Macro Assemblers, there are a lot of things that help make your code seem "higher level" (IFs, PROC LOCAL, etc).

Bigger projects benefit from higher level languages. That''s the reason why languages like C, and then C++ came along... to support bigger projects.

But hey... you can always use both

Nathan.


nathany.com
Advertisement
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( );

~CGameProgrammer( ); Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
ok let''s see. I''ve never programmed in assembly so let''s just say that it takes x times as long as normal programming. Thus to get the game out on time you need x times as many programmers. Thus the cost of the game becomes x times the cost of programming + the cost of the other stuff like art. Wouldn''t you like the cost of x to be as low as possible, perhaps 1? It is cheaper for the player to buy a stronger computer than to pay for games written in assembly. Of course a little assembly might be worth it, but writting entire games in assembly would be an extreme waste of money. No company could make a profit writing games in assembly.
Generally, I think the suggestion is to use C/C++ or whatever high level language you''re using first, then put in ASM optomizations later.
quote: Original post by Aztec

why isn''t there more attention paid to programming in assembly language? it is faster, more efficient, and an all around better language. It would seem that more people would want to program in it......


1) todays compilers produce highly optimized code; many assembly programmers do not have sufficient experience to beat they in performace.

2) it''s far too difficult to develop a huge program entirely in assembly;

3) assembly learning rate is not very fast and (at least at the beginning) it can be kinda frustrating;

4) todays computer science poses a lot on "portable-programming"; by programming in assembly you''ll code a program not-so-portable... well, even if you program under Windows, though...

... however, knowing (a bit of) assembly is something that every programmer should seriously take into account.


Bye,

Karmalaa

---[home page] [[email=karmalaa@inwind.it]e-mail[/email]]

This topic is closed to new replies.

Advertisement