??? 12/09/04 16:56 Read: times |
#82840 - Speed writing vs speed running. Responding to: ???'s previous message |
Well written ASM programs run faster. No C optimizing compiler can create faster ASM code that a seasoned programmer. But ASM, being simpler is way more limited - simple things may be easier that in C, but more advanced, like recursion, complex protocols, advanced maths become suddenly very difficult. Just think about this:
#include<math.h> (...) float x=5,y; y=exp(sin(x)*sqrt(x)); Can you think of an ASM equivalent for this one? Can you call it easier or more easy to follow? There are tasks where writing in assembler is just wasting your time - when you have more than enough spare memory, more than enough CPU cycles but the task at hand would require a lot of work from you - work, somebody has done in the past already. If your program has to sample sound 10.000 times a second, you can't afford the sloppiness of C. You must use assembly. But if the MPU wakes up once a hour to read some attached sensors, perform calculations on the gathered data, make a decision whether to contact the central database and if so, dial a number on the modem, then send 5 kilobytes of data over TCP/IP, you'd be crazy to implement it all in assembly - your timeframe is not microseconds but minutes, and the task is composed of several hundreds of -different- operations, splitting it up into ASM commands and worrying about things like which bank of R-registers contains the gateway address and network mask would drive you crazy. Of course most of tasks set for '51 class microcontrollers is simple enough that it makes no difference. But there are subsets where chosing the right language is essential. |
Topic | Author | Date |
asm vs C | 01/01/70 00:00 | |
HLL | 01/01/70 00:00 | |
asm vs C | 01/01/70 00:00 | |
C and other HLLs | 01/01/70 00:00 | |
modern - productive | 01/01/70 00:00 | |
Lunch | 01/01/70 00:00 | |
Speed writing vs speed running. | 01/01/70 00:00 | |
C | 01/01/70 00:00 | |
Belt or suspenders? | 01/01/70 00:00 | |
Learn C Then... | 01/01/70 00:00 | |
beware | 01/01/70 00:00 | |
This advice is great | 01/01/70 00:00 | |
I love C !!! | 01/01/70 00:00 | |
Easy migration | 01/01/70 00:00 | |
3rd party | 01/01/70 00:00 | |
Having recently started converting... | 01/01/70 00:00 | |
Learning C for tte 8051 and 8-bit uC | 01/01/70 00:00 | |
Obviously there is a reason... | 01/01/70 00:00 | |
as to reasons | 01/01/70 00:00 | |
Obviously there is a reason... | 01/01/70 00:00 | |
8051 vs C :) | 01/01/70 00:00 | |
8051 efficiency | 01/01/70 00:00 | |
a 51 for handling large amount of data | 01/01/70 00:00 | |
8051 vs C - answer is wrong | 01/01/70 00:00 | |
addendum to post Andys above | 01/01/70 00:00 | |
asm.vs.C forever | 01/01/70 00:00 | |
click, click, click | 01/01/70 00:00 | |
Eh?? | 01/01/70 00:00 | |
8051 vs C - answer is wrong | 01/01/70 00:00 | |
Don't believe all you hear! | 01/01/70 00:00 | |
the C myth | 01/01/70 00:00 | |
myth | 01/01/70 00:00 | |
Then Don't Do that | 01/01/70 00:00 | |
Exactly! | 01/01/70 00:00 | |
why only? | 01/01/70 00:00 | |
Right tool for the Job | 01/01/70 00:00 | |
asm VS C | 01/01/70 00:00 | |
Which C? | 01/01/70 00:00 | |
? | 01/01/70 00:00 | |
Handly, But | 01/01/70 00:00 | |
Both i think | 01/01/70 00:00 | |
Neither! | 01/01/70 00:00 | |
Compiler on a floppy? | 01/01/70 00:00 | |
Why do people use C? | 01/01/70 00:00 | |
Code Complete | 01/01/70 00:00 | |
Ironic | 01/01/70 00:00 | |
Re: asm VS C | 01/01/70 00:00 | |
re:asm vs C | 01/01/70 00:00 | |
derivatives of same | 01/01/70 00:00 | |
portability | 01/01/70 00:00 | |
re: portability | 01/01/70 00:00 | |
(non-)portability | 01/01/70 00:00 | |
re: | 01/01/70 00:00 | |
re:![]() | 01/01/70 00:00 | |
What do you want? | 01/01/70 00:00 | |
HLL | 01/01/70 00:00 | |
Personal dislike... | 01/01/70 00:00 | |
A comment to ASM versus C | 01/01/70 00:00 |