Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Why Learning Assembly Language is Still a Good Idea?
Goto page 1, 2  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  Come here Post :: Post Signature for me?  View next topic  
Author Message
nintendo64
Seasoned Helper


Age:40
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 104
Location: Dominican Republic
Offline

PostPosted: Fri May 07, 2004 12:48 am   Post maybe stupid    Post subject: Why Learning Assembly Language is Still a Good Idea? Reply to topic Reply with quote

Good read for programmers,

http://www.onlamp.com/pub/a/onlamp/2004/05/06/writegreatcode.html

I see your point, Mr Ekted, i do beleive the internals should be the main focus, even thought the author of this article shows learning assembly is a good way for gaining this knowledge. I admit, he was advertising assembly icon_smile.gif, he went a little overboard.

-nintendo64


Last edited by nintendo64 on Fri May 07, 2004 3:16 am, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Fri May 07, 2004 1:39 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Nice. And agreed. L1K

It's not even the point to learn ASM per se, just to understand the kinds of things that happen on the inside. Most programs treat the computer like a black box, and they end up writing slow bloated crap like ICQ, Internet Explorer, WinAmp, Windows Media Player, etc.
_________________
4,691 irradiated haggis!
Back to top
View users profile Send private message Add User to Ignore List
Qndre
Server Help Squatter


Gender:Gender:Male
Joined: Jan 25 2004
Posts: 295
Offline

PostPosted: Fri May 07, 2004 8:57 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

You can write everything in ASM, you can also write in other languages. (Because every high-language becomes ASM after compilation!) But in ASM you can do more. And it's very useful for reverse-engineering. But it's hard to learn.
Back to top
View users profile Send private message Add User to Ignore List
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:42
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Fri May 07, 2004 9:26 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Qndre wrote:
But it's hard to learn.

Its easy to learn, as there are only so many different instructions. Its just difficult to master, because there nothing watching over you saying "oops, there is an error."
Back to top
View users profile Send private message Add User to Ignore List Send email
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri May 07, 2004 10:26 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Read the article before you comment, Qndre.

I think telling all modern-day programmers to learn ASM is a little over-the-top, since many would not do it. I think the simplest way to improve code is just to know smaller code is smaller compiled code (usually), and also take into consideration what external methods they are using to accomplish their goals. If everyone wrote windows apps with the Windows API instead of the bloated MFC, programs would shave off huge chunks of their run-time bulk.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
NightHawk
Newbie


Joined: Dec 09 2003
Posts: 20
Location: Sabotage'd
Offline

PostPosted: Fri May 07, 2004 1:47 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

I'm getting my Comp Sci degree at a University, and had to take an assembly course in my second year. I thought that this would be standard material at other institution.. am I wrong?
Back to top
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Fri May 07, 2004 3:46 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

I had a look at some U's and only one said the asm was an optional module that was taken in the electronics department. My main impression was that they were focusing on AI/neural networks and consultancy ('we don't live in India so we don't have to code' was the message I got).
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Fri May 07, 2004 4:08 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

I am not saying that people should write their apps in ASM. I am saying that by learning ASM it helps you understand HOW to design and write better code in whatever language you choose -- orders of magnitude better.
Back to top
View users profile Send private message Add User to Ignore List
nintendo64
Seasoned Helper


Age:40
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 104
Location: Dominican Republic
Offline

PostPosted: Fri May 07, 2004 4:45 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

For the people that are saying, "not everything should be written in assembly", they are right, but that's not what the article is saying, why don't go read it? The Article is talking about that many programmers don't know how the internals works, hence the bloatware applications.

Assembly is a just a good way to learn how the computer treats your variables (on the stack or on the heap), etc.. the internals.

Main point of the Article

Quote:
The only problem with the demise of assembly language is that as its popularity waned, so did the percentage of programmers who understood the low-level ramifications of the code they were writing. Those programmers who were claiming that assembly language was dead already knew how to think in assembly language and how to apply that low-level thinking to their high-level code; in effect, enjoying the benefits of assembly language while writing high-level language code. However, as new programmers worked their way into the system, without the benefits of having written several applications in assembly, the efficiency of software applications began to decline.


-nintendo64


Last edited by nintendo64 on Fri May 07, 2004 4:49 pm, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Fri May 07, 2004 4:49 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

the difference here is between a designer and a computer scientist. This is not to say that great coders can't benefit, they certainly will. However, many of the low-level protocols and high-efficiency environments are merely implemented by coders, while the actual theory behind them is implemented by true nuts and bolts computer scientists.

try to look at it this way, in a game like Quake or Unreal, the engine itself is hot-wired for speed speed speed. I would venture to say that many of algorithms in either engine bank on ASM code or snippets for fast and efficient access to system resources. I haven't seen said code, of course, but it seems only logical given the tremendous performance achieved.
Even less impressive apps benefit from assembly procedures, especially in processing large data structures ie image editing, sound, and scientific data processing.

in approaching assembly, i never set out to actively code in assembly, as that is a step into an expertise which i share no stake in. I did, however, take the time to learn how a program is written in ASM and try to comprehend the small ASM parts that make up the implementation of higher-level processes (ie other language constructs). in other words, mentally comprehending, step by step, the transfer from C to ASM in terms of what the programmer indicated and what was accomplished.

i suppose an auto mechanic analogy would be good in this case. A good mechanic can fix a belt or true an axle or fix even trivial engine problems, yet they can do nothing immediate about malfunctions in the high precision machined parts within the engine. the good ones know what goes on inside and how to prevent wear, tear, and get the highest performance, but they don't necessarily carry qualifications for developing such parts.

becoming familiar with assembly language shares a common purpose. you will understand better how to transfer ideas from your mental process into computer instructions, even if that process does not take place in ASM, but in another language...

java programmers needn't bother
_________________
Signatures just seem so quaint.
Back to top
View users profile Send private message Add User to Ignore List
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Fri May 07, 2004 4:52 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Mr Ekted wrote:
I am not saying that people should write their apps in ASM. I am saying that by learning ASM it helps you understand HOW to design and write better code in whatever language you choose -- orders of magnitude better.

(my preceding post): no shit
Back to top
View users profile Send private message Add User to Ignore List
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Fri May 07, 2004 4:57 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

I was replying to Qndre mostly. I should have quoted him.
Back to top
View users profile Send private message Add User to Ignore List
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Fri May 07, 2004 7:15 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Code: Show/Hide
int i;
char buffer[256];

// code that sets buffer here

for (i = 0; i < strlen(buffer); i++)
   if (buffer[i] == ' ')
      buffer[i] = '_';


What's wrong with this?

1. strlen() is called every loop. This will easily make this loop 10x slower, maybe more.

2. Indexing is expensive, even for char arrays. If you are sequentially walking an array, use a pointer.

Code: Show/Hide
char *p;
char ch;
char buffer[256];

// code that sets buffer here

p = buffer;

while (ch = *p)
   {
   if (ch == ' ')
      *p = '_';

   p++;
   }


This is a tiny example. You can't fix most poorly written apps by tweaking 10 lines of code at a time. They have inefficiencies in design (functional, data structures, etc).
Back to top
View users profile Send private message Add User to Ignore List
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:42
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Fri May 07, 2004 8:29 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Mr Ekted wrote:
strlen() is called every loop

Actually, Microsoft's optimizing compiler fixes this problem for people, as it does for the simple indexing code you wrote. But that doesn't excuse people from writing sloppy in the first place.
Back to top
View users profile Send private message Add User to Ignore List Send email
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Fri May 07, 2004 8:59 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Only because strlen() can be an "intrinsic" function. If it was an arbitrary function, the compiler cannot make the assumption that it only needs to call it once. Agreed otherwise.
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sat May 08, 2004 12:07 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Code: Show/Hide
char *p;
char ch;
char buffer[256];

// code that sets buffer here

p = buffer;

while (ch = *p)
   {
   if (ch == ' ')
      *p = '_';

   p++;
   }

Can't you just do
Code: Show/Hide
while (*p)
{
   if (*p == ' ')
      *p = '_';
}

Maybe I'm just overlooking something obvious.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
SuSE
Me measures good


Joined: Dec 02 2002
Posts: 2307
Offline

PostPosted: Sat May 08, 2004 12:28 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

<measures dick>
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Dustpuppy
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Jan 23 2003
Posts: 215
Location: England
Offline

PostPosted: Sat May 08, 2004 1:48 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Cyan~Fire wrote:
Code: Show/Hide

while (*p)
{
   if (*p == ' ')
      *p = '_';
}



That would be an infinite loop because p is never advanced...
_________________
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
-Smong-
Guest


Offline

PostPosted: Sat May 08, 2004 2:17 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

I think char ch will probably be a register so the if() is faster. Although it's not the sort of think I would think up myself.
Back to top
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Sat May 08, 2004 3:31 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

I prefer to be explicit. If you do:

Code: Show/Hide
while (*p)
   {
   if (*p == ' ')
      *p = '_';

   p++;
   }


you are dereferencing p twice (testing *p). Granted the optimizer should handle it, but who knows.
Back to top
View users profile Send private message Add User to Ignore List
Grav(FU OL)
Guest


Offline

PostPosted: Sun May 09, 2004 11:05 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

I totaly agree, understanding the very basic principals is the most important thing.
Take math for example, sin, cosin, tangent, log, etc., today's kids - they just push buttons, they rarely understand what exactly is going on there.
Tell them to do manual calculations for a square root of 1, they won't know how to, they'll ask for a computer.
I always argued against the education system in that fashion, being able to know how to operate a hand held computer is all nice and dandy and sure, it makes calculations easier and faster, but it also dulls the brain, you need to know for yourself and understand what exactly is happening there.

Take McGuyver for an example, sure most of the time it was a bit over the top and more lcuky than one should and would be, but still, it pushed a strong message of relaying upon intelligence, knowledge, understanding, brain power instead of brawn power.


P.S.

Efficient Coding: http://www.theprodukkt.com/


P.P.S:
DIE SCUM!
Back to top
Grav(FU OL)
Guest


Offline

PostPosted: Sun May 09, 2004 11:08 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Also for example, there was back then BATTLETECH 3025.
The entire MMOFPS ran on 36MBs total!!!
I have no idea how they compressed shit so tight and so forth, but boy, they did it.
Back to top
Grav(FU OL)
Guest


Offline

PostPosted: Sun May 09, 2004 11:09 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

In addition: assembly rox
Back to top
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun May 09, 2004 11:43 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Ekted wrote:
you are dereferencing p twice (testing *p). Granted the optimizer should handle it, but who knows.

icon_eek.gif I think I'll just go with Akai...
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Sun May 09, 2004 11:49 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

SuSE wrote:
<measures dick>


... in pixels.
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Trash Talk All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 45 page(s) served in previous 5 minutes.

phpBB Created this page in 0.729778 seconds : 50 queries executed (75.1%): GZIP compression disabled