I've never said that assembly is a useless skill in general, obviously there are quite a few applications (compilers, embedded systems..). I am just saying that most of the time using assembly for performance reasons is a waste of time when high level languages are available.reptor wrote:When you shoot the assembly programming down as an unnecessary thing, consider that while it may be completely useless to you, that doesn't mean it is useless for everyone.
Learn some assembly
-
jjp
- Silver Sponsor

- Posts: 597
- Joined: Sun Jan 07, 2007 11:55 pm
- Location: Cologne, Germany
- Contact:
Re: Learn some assembly
- Nauk
- Gnoll
- Posts: 653
- Joined: Thu May 11, 2006 9:12 pm
- Location: Bavaria
- x 36
- Contact:
Re: Learn some assembly
Kojack wrote: I believe that with each version software should be made to work faster and better on the same hardware. In version 2 of something you find the bottlenecks, have had time to research new algorithms, learnt new optimising tricks, etc. Like how games on a console years after release are much more technically advanced than when the console is brand new, because the coders learn to take advantage of what they have better. But Windows doesn't go like that. Instead of optimising what's there, they just add more on top, requiring better hardware to keep the old stuff going.
Assembly won't help, it's the operating system that causes most of it. Although maybe windows should be written in assembly...
Exactly my thought
Harddisks have gotten a lot faster in the last 20 years and I really don't think that has anything to do with it, anyway with the rest you sure got a clear point, but I don't think that covers it all, only to a certain percentage.jjp wrote:Hard disks haven't gotten much faster. That is one major point where bad responsiveness originates from. C++ compile times are high because C++ compilers are that good at optimizing. Take a C++ compiler from 10 years ago and it will run super fast in comparison. But the code produced will be a lot worse. And C++ isn't exactly a language designed for fast compilation times. Work with C# (for example) and you won't be having any forced breaks due to recompilation
Also, you're not really getting the whole picture here. If you'd compare equally complex software from today and from 10 years ago you might as well note some differences in terms of reliability and security, for example.
As for the slow C++ compile times syedhs answer probably covers that one:
syedhs wrote:Hmm isn't the prime reason C++ compilation is slow even on fast pc because of template? Try compile a plain .C file - it is stupid blindingly fast!
No thanks - I had to work with it almost 2 years daily, the language is nice, and with the huge application we developped with it a full recompile still was a coffee break. Besides imho one of the reasons for nowadays still slow applications is the extensive use of C#, Java or other pseudo-compiled byte-code interpreted runtime based languages. If i have to take compile-time breaks then I want at least want native x86 machine code as result, otherwise I prefer a oridinary oldschool interpreted language anyday because that grants really speedy development and quick changes. If it really has to be then Java has the clear advantage tho, it is nearly flawlessly crossplatform able and you still can compile it to x86 native.jjp wrote:Work with C# (for example) and you won't be having any forced breaks due to recompilation
I think at this part of the discussion it is time for some hard numbers, I have already looked around a bit but I couldn't find any benchmark charts on the subject at all, just discussions not being backed up with numbers and data. Doesn't anyone have a good link or chart somewhere stashed away or bookmarked?
Oh and another one for nostalgias sake:

ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
-
jjp
- Silver Sponsor

- Posts: 597
- Joined: Sun Jan 07, 2007 11:55 pm
- Location: Cologne, Germany
- Contact:
Re: Learn some assembly
If you compare the speedup with how much CPUs have gotten faster really not that much has happened on the hard disk front. Also the problem isn't throughput but the initial latency of a disk read/write.Nauk wrote:Harddisks have gotten a lot faster in the last 20 years and I really don't think that has anything to do with it
- Nauk
- Gnoll
- Posts: 653
- Joined: Thu May 11, 2006 9:12 pm
- Location: Bavaria
- x 36
- Contact:
Re: Learn some assembly
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
- jacmoe
- OGRE Retired Moderator

- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: Learn some assembly
Semi-ly so. It's compiled to CLR, and therefore you cannot compare the compile time of C++ with C#.jjp wrote:C# code is never interpreted
If you're not using any STL (Boost is a killer), then C++ compiles are really fast.
@Nauk:
Yeah, Guru Meditations are cool!
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
Re: Learn some assembly
My spherical harmonic demo has a single source file: a 695 line cpp.
The generated .i file is 548741 lines of c++ (ok, a lot of blank lines, but it's still huge. 3.7MB of text). That's what's really being compiled. Precompiled headers and stuff help with that of course.
I've had simple ogre apps hit a million lines of code, based on what headers I've included, even if I didn't use them.
Another big problem with hard drives is that windows doesn't always do things in an efficient way. For example, searching for a file by name.
On my previous computer (Athlon X2, Windows XP, around 1.5 terrabytes spread over 6 western digital sata hard drives and 12+ partitions) doing a simple file search for a single word in the filename took about 1.5 hours.
Doing the same search on the same drives and finding the same results using SearchGT (a shareware tool) takes under 45 seconds. That's with no caching, no indexing, run straight after installing the program for the first time. It goes straight to the lowest level raw access to ntfs, bypassing all the windows crap.
- _tommo_
- Gnoll
- Posts: 677
- Joined: Tue Sep 19, 2006 6:09 pm
- x 5
- Contact:
Re: Learn some assembly
- Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
Re: Learn some assembly
You can set it to No (the .i is never actually saved, it's fed directly into the compiler), Without Line Numbers and With Line Numbers.
The .i will end up in the same directory as your vcproj file.
The other fun option is C++ / Advanced / Show Includes. Turn that on and the compiler output will recursively list every include as it's included. It will look something like this:
Code: Select all
1>Note: including file: F:\work\qgf4_0.011\components\ogre\ogremain\include\OgreTexture.h
1>Note: including file: f:\work\qgf4_0.011\components\ogre\ogremain\include\OgrePrerequisites.h
1>Note: including file: f:\work\qgf4_0.011\components\ogre\ogremain\include\OgrePlatform.h
1>Note: including file: f:\work\qgf4_0.011\components\ogre\ogremain\include\OgreConfig.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\istream
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\ostream
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\ios
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xlocnum
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\climits
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\yvals.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\crtdefs.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\sal.h
1>Note: including file: c:\program files (x86)\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\crtassem.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\vadefs.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\use_ansi.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\limits.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\crtdefs.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\cstdio
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\crtdefs.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\swprintf.inl
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\cstdlib
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdlib.h
1>Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\crtdefs.h
- _tommo_
- Gnoll
- Posts: 677
- Joined: Tue Sep 19, 2006 6:09 pm
- x 5
- Contact:
Re: Learn some assembly
I compiled with that options... i have 107 mb of .i files, and 37279 includes
I think the weight comes from PhysX + Ogre, wich are included in most of the files...
- Nauk
- Gnoll
- Posts: 653
- Joined: Thu May 11, 2006 9:12 pm
- Location: Bavaria
- x 36
- Contact:
Re: Learn some assembly
And there you would think one of the most successful companies in the world should be able to afford quality coding and problem solving, I really wonder sometimes what the people working for M$ are doing all day long.Kojack wrote:Another big problem with hard drives is that windows doesn't always do things in an efficient way. For example, searching for a file by name.
On my previous computer (Athlon X2, Windows XP, around 1.5 terrabytes spread over 6 western digital sata hard drives and 12+ partitions) doing a simple file search for a single word in the filename took about 1.5 hours.
Doing the same search on the same drives and finding the same results using SearchGT (a shareware tool) takes under 45 seconds. That's with no caching, no indexing, run straight after installing the program for the first time. It goes straight to the lowest level raw access to ntfs, bypassing all the windows crap.
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
- Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
Re: Learn some assembly
Watching youtube and looking at stupid cat pictures like the rest of us.I really wonder sometimes what the people working for M$ are doing all day long.
- Nauk
- Gnoll
- Posts: 653
- Joined: Thu May 11, 2006 9:12 pm
- Location: Bavaria
- x 36
- Contact:
Re: Learn some assembly
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
- nikki
- Old One
- Posts: 2730
- Joined: Sat Sep 17, 2005 10:08 am
- Location: San Francisco
- x 13
- Contact:
- Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
Re: Learn some assembly
Then if you haven't gone insane from stack based languages, give Piet a try. http://www.dangermouse.net/esoteric/piet.html
- Nauk
- Gnoll
- Posts: 653
- Joined: Thu May 11, 2006 9:12 pm
- Location: Bavaria
- x 36
- Contact:
Re: Learn some assembly
hahawiki wrote:FALSE is an esoteric programming language designed by Wouter van Oortmerssen in 1993, named after his favorite Boolean value. It is a small Forth-like stack-oriented language, with syntax designed to make the code inherently obfuscated, confusing, and unreadable. It is also noteworthy for having a compiler of only 1024 bytes (written in 68000 assembly). According to van Oortmerssen, FALSE provided the inspiration for various well known esoteric languages, including brainfuck and Befunge.
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Re: Learn some assembly
Actually, even with Boost and the SC++L, C++ compiles crazy fast. I've found that Ogre is that one library I use that kills compile speed completely (and link speed, too).jacmoe wrote: If you're not using any STL (Boost is a killer), then C++ compiles are really fast.![]()
- lonewolff
- Ogre Magi
- Posts: 1207
- Joined: Wed Dec 28, 2005 12:58 am
- x 6
Re: Learn some assembly
I dont know how I will go not having access to classes and the like though
-
Vectrex
- Ogre Magi
- Posts: 1266
- Joined: Tue Aug 12, 2003 1:53 am
- Location: Melbourne, Australia
- x 1
- Contact:
Re: Learn some assembly
Do you use precompiled headers for Ogre? That mostly solved it for menullsquared wrote:Actually, even with Boost and the SC++L, C++ compiles crazy fast. I've found that Ogre is that one library I use that kills compile speed completely (and link speed, too).jacmoe wrote: If you're not using any STL (Boost is a killer), then C++ compiles are really fast.![]()
- lonewolff
- Ogre Magi
- Posts: 1207
- Joined: Wed Dec 28, 2005 12:58 am
- x 6
Re: Learn some assembly
I am using VS.net 2008 Express as my IDE of choice.
I have created a C++ app using pure Win32 API calls to create a window, an edit box, and a button.
When you type in the edit box and press the button, the contents of the edit box is echoed in a message box. Pretty simple.
The end result is a ~30Kb file that requires VC runtimes (1.7Mb) to be installed on any other system for the app to run.
I have just programmed the same application in assembly.
The end result is a 2.5Kb file that requires no additional runtimes installed whatsoever. I just tested on a clean install of Windows XP SP1, that has no windows updates at all
So thats it.
C++ 30Kb + 1.7Mb overhead
Vs
Asm 2.5Kb (Total)
For the same application!
How cool is that!
-
Owen
- Google Summer of Code Student

- Posts: 91
- Joined: Mon May 01, 2006 11:36 am
- x 21
Re: Learn some assembly
They also, of course, spend their time optimizing their C to help the compiler optimize it better, but in some cases, you can't beat hand written assembly
- Nauk
- Gnoll
- Posts: 653
- Joined: Thu May 11, 2006 9:12 pm
- Location: Bavaria
- x 36
- Contact:
Re: Learn some assembly
Totally in my book - one of the things that keeps me poking around in the languagelonewolff wrote: C++ 30Kb + 1.7Mb overhead
Vs
Asm 2.5Kb (Total)
For the same application!
How cool is that!
I have found a pretty interesting conversation on the subject while i was googling for something entirely different - good read:
http://www.pldesignline.com/howto/20100 ... JVN?pgno=1
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
- syedhs
- Silver Sponsor

- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
Re: Learn some assembly
To be honest, it sounds like a 'delicious' job to me. Millions of vector math with optimized assemblyOwen wrote:They seem to spend most of their time hand optimizing their code with the millions of vector math extensions that processors have these days
If you really want super-tiny executable size, then use Debug(.exe/.com?) packaged in MSDOS. Yes MSDOS, not windows DOS. You can produce as small as 10 bytes COM application (I dont know really the smallest size possible, but 20 bytes are definitely attainable). Okay not the Component Object Model but an executable with extension .COM that uses TINY memory model - hehe bringing me back the nostalgia of using Turbo C 1.5. Tiny Memory Model was hot back then in 16 bit application where you can't access more than 65K of RAM as one variable, unless of course you use the huge modifier. Tiny Memory Model packs the both executable code and data segment into only one segment therefore limits the executable size to < 65K.
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
- lonewolff
- Ogre Magi
- Posts: 1207
- Joined: Wed Dec 28, 2005 12:58 am
- x 6
Re: Learn some assembly
Switching graphics modes in 4 lines of assembly. Those were the days.
Unfortunatly, there is not really a big future in 16 bit assmbly. As people who own 64 bit windows wont be able to run it due to lack of 16 bit subsystem.
- Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
Re: Learn some assembly
Maybe not on pc, but on other platforms it's still useful. The ARM cpu has both Arm (32bit) and Thumb (16bit) instruction sets, and you can switch between them at any time based on the lowest bit of the address of a jump instruction. Thumb instructions allow you to pack a lot of functionality into a much smaller space, and can run better on certain memory types. Arm code is more powerful than thumb code, but working with 32 bits can have an unneeded overhead.Unfortunatly, there is not really a big future in 16 bit assmbly.
Arm chips are all over the place these days.
-
reptor
- Ogre Magi
- Posts: 1120
- Joined: Wed Nov 15, 2006 7:41 pm
- Location: Finland
- x 5