Digital Man wrote to Nightfox <=-ãã DM> @MSGID: <6181D1FD.5354.dove-prg@vert.synchro.net>ã DM> @REPLY: <61816B3D.3316.dove_dove-prg@digitaldistortionbbs.com>ã DM> Re: C is the most efficient programmingã DM> languageã DM> By: Nightfox to All on Tueã DM> Nov 02 2021 09:45 amãã > I haven't done much programming in pure C, but I thought this article wasã > interesting. It says C is the most efficient programming language as far asã > power consumption, speed, and memory usage:ãã DM> They actually have Python over C in regards to memory usage. (!?!)ãã DM> Assembly language could beat C in those same categories, but it's not aã DM> serious contender for similar reasons that C is not a serious contenderã DM> for a lot of software development tasks - because there are other veryã DM> important factors such as development time, verification andã DM> validation, extensibility and maintenance.ãã DM> I like and use C a lot, but it's not "the most efficient programmingã DM> language" for all forms of efficiency. Depending on the job, some otherã DM> forms of efficiency matter more than eeking out that extra 1% ofã DM> performance or resource optimization. --ã DM> digital manããI wouldn't call Assembly a Language. There isn't really a language per so,ãjust mnemonics and instructions to the assembler itself. It is more a systemãto assembly machine code, and the efficiency of assembly is heavily dependentãon the ability of the programmer.ãã... MultiMail, the new multi-platform, multi-format offline reader!ã--- MultiMail/Linux v0.52ã þ Synchronet þ MS & RD BBs - bbs.mozysswamp.orgã
Nightfox wrote to Boraxman <=-ãã Ni> @MSGID: <6186CB4C.3331.dove_dove-prg@digitaldistortionbbs.com>ã Ni> @REPLY: <61863E0B.2745.dove-prg@bbs.mozysswamp.org>ã Ni> Re: C is the most efficient pã Ni> By: Boraxman to Digital Man onã Ni> Sat Nov 06 2021 07:33 pmãã Bo> I wouldn't call Assembly a Language. There isn't really a language per so,ã Bo> just mnemonics and instructions to the assembler itself. It is more aã Bo> system to assembly machine code, and the efficiency of assembly is heavilyã Bo> dependent on the ability of the programmer.ãã Ni> I always thought assembly was a language, in that it consists ofã Ni> statements you can use to control logic and program flow. Assembly hasã Ni> a 'vocabulary' of keywords (or instructions) that make up the language.ã Ni> But every CPU has its own assembly.ãã Ni> Nightfoxã Ni> ã Ni> ---ã Ni> = Synchronet = Digital Distortion: digitaldistortionbbs.comããTrue, but with C, something likeãfor (int x = 0; x < 100; ++x) {ã a*=x;ã }ããThat code is defined by a language, a specification. What "for" and "int" meanãare defined by the language. The structure of the code is defined by theãlanguage. That is to say, C is actually a set of rules, a formal language thatãthen gets converted to machine code.ããBut with Assembler, there is not formal Assembler specification, no Assemblyãkeywords, etc, they are all implementation specific.ãã... MultiMail, the new multi-platform, multi-format offline reader!ã--- MultiMail/Linux v0.52ã þ Synchronet þ MS & RD BBs - bbs.mozysswamp.orgã
Nightfox wrote to Boraxman <=-ãã Ni> @MSGID: <61C60A0E.3336.dove_dove-prg@digitaldistortionbbs.com>ã Ni> @REPLY: <61C5AF39.2749.dove-prg@bbs.mozysswamp.org>ã Ni> Re: C is the most efficient pã Ni> By: Boraxman to Nightfox onã Ni> Fri Dec 24 2021 10:17 pmãã Bo> That code is defined by a language, a specification. What "for" and "int"ã Bo> mean are defined by the language. The structure of the code is defined byã Bo> the language. That is to say, C is actually a set of rules, a formalã Bo> language that then gets converted to machine code.ãã Bo> But with Assembler, there is not formal Assembler specification, noã Bo> Assembly keywords, etc, they are all implementation specific.ãã Ni> But still, assembler for each processor is defined by the operationsã Ni> that the processor understands, and there is a specific syntax for eachã Ni> operation.ãã Ni> Nightfoxã Ni> ã Ni> ---ã Ni> = Synchronet = Digital Distortion: digitaldistortionbbs.comããHave you ever used AT&T syntax?ãã... MultiMail, the new multi-platform, multi-format offline reader!ã--- MultiMail/Linux v0.52ã þ Synchronet þ MS & RD BBs - bbs.mozysswamp.orgã
Nightfox wrote to Boraxman <=-ãã Ni> @MSGID: <61C6BCF6.3338.dove_dove-prg@digitaldistortionbbs.com>ã Ni> @REPLY: <61C649CF.2751.dove-prg@bbs.mozysswamp.org>ã Ni> Re: C is the most efficient pã Ni> By: Boraxman to Nightfox onã Ni> Sat Dec 25 2021 09:12 amãã Ni>> But still, assembler for each processor is defined by the operationsã Ni>> that the processor understands, and there is a specific syntax forã Ni>> each operation.ãã Bo> Have you ever used AT&T syntax?ãã Ni> I haven't.ããIt's an alternative syntax for assembler, used by GAS and I guess otherãassemblers for Unix too.ããAn example from a program I wrote is belowãã movl %eax, BRK_Startã movl %eax, BRK_Endã movl (%esp), %ecxã cmp $1, %ecxã je clifailã cmp $3, %ecxã jg clifailã movl 8(%esp), %ebxã jl successã movb (%ebx), %alãããAs you can see, the syntax is familiar, but different. Source and destinationãare the other way around for MOV commands, the offset notation is different,ãimmediate values are prefixed with a $.ãã... MultiMail, the new multi-platform, multi-format offline reader!ã--- MultiMail/Linux v0.52ã þ Synchronet
þ MS & RD BBs - bbs.mozysswamp.orgã
Digital Man wrote to Boraxman <=-ãã DM> @MSGID: <61C89E1F.5377.dove-prg@vert.synchro.net>ã DM> @REPLY: <61C84490.2753.dove-prg@bbs.mozysswamp.org>ã DM> Re: C is the most efficient pã DM> By: Boraxman to Nightfox onã DM> Sun Dec 26 2021 09:27 pmãã > -=> Nightfox wrote to Boraxman <=-ã >ã > Ni> @MSGID: <61C6BCF6.3338.dove_dove-prg@digitaldistortionbbs.com>ã > Ni> @REPLY: <61C649CF.2751.dove-prg@bbs.mozysswamp.org>ã > Ni> Re: C is the most efficient pã > Ni> By: Boraxman to Nightfox onã > Ni> Sat Dec 25 2021 09:12 amã >ã > Ni>> But still, assembler for each processor is defined by the operationsã > Ni>> that the processor understands, and there is a specific syntax forã > Ni>> each operation.ã >ã > Bo> Have you ever used AT&T syntax?ã >ã > Ni> I haven't.ã >ã > It's an alternative syntax for assembler, used by GAS and I guess otherã > assemblers for Unix too.ã >ã > An example from a program I wrote is belowã >ã > movl %eax, BRK_Startã > movl %eax, BRK_Endã > movl (%esp), %ecxã > cmp $1, %ecxã > je clifailã > cmp $3, %ecxã > jg clifailã > movl 8(%esp), %ebxã > jl successã > movb (%ebx), %alã >ã >ã > As you can see, the syntax is familiar, but different. Source andã > destination are the other way around for MOV commands, the offset notationã > is different, immediate values are prefixed with a $.ãã DM> Motorola 68K assemblers used the "move source, destination" as wellã DM> (opposite of Intel/x86 assemblers).ãã DM> Basically, there's no real "standard" when it comes to assemblyã DM> languages. --ããExactly, which is why I don't consider a language, because there isn't actuallyãa standard to construct a language. Each author of an assembler can make upãwhatever they like. FASM is a language. MASM is a language, AT&T Intel is aãlanguage, NASM is a language, etc etcããã... MultiMail, the new multi-platform, multi-format offline reader!ã--- MultiMail/Linux v0.52ã þ Synchronet þ MS & RD BBs - bbs.mozysswamp.orgã
Nightfox wrote to Boraxman <=-ãã Ni> I see what you mean about assembler. But I'd think you could alsoã Ni> argue that each processor's assembler is its own language, even thoughã Ni> there is no standard for assembler.ããThere sort of is. Back in the 80's they had macro assemblers.ããThink of these as in between something like C and assembler. It looked likeãassembly language, but it was "generic" (to a point). The compiler (that'sãwhat it was) would convert your generic assembler into the specific assemblyãcode for your procssor.ããSo, in theory, you could write one set of code for a family of processorsã(Intel 80x or Z80) that could be compiled across all the processors in theãfamily.ããI don't know if they had one that would let you write for something like theãZ80 and the 6502, though.ããã... Lead me not into temptation, I can find my own wayã--- MultiMail/Linux v0.52ã þ Synchronet þ Diamond Mine Online BBS - bbs.dmine.net:24 - Fredericksburg, VA USAã
Dr. What wrote to Nightfox <=-ãã DW> @MSGID: <61CDB562.2970.dove-program@dmine.net>ã DW> @REPLY: <61CC93F1.3342.dove_dove-prg@digitaldistortionbbs.com>ã -=> Nightfox wrote to Boraxman <=-ãã Ni> I see what you mean about assembler. But I'd think you could alsoã Ni> argue that each processor's assembler is its own language, even thoughã Ni> there is no standard for assembler.ãã DW> There sort of is. Back in the 80's they had macro assemblers.ãã DW> Think of these as in between something like C and assembler. It lookedã DW> like assembly language, but it was "generic" (to a point). Theã DW> compiler (that's what it was) would convert your generic assembler intoã DW> the specific assembly code for your procssor.ãã DW> So, in theory, you could write one set of code for a family ofã DW> processors (Intel 80x or Z80) that could be compiled across all theã DW> processors in the family.ãã DW> I don't know if they had one that would let you write for somethingã DW> like the Z80 and the 6502, though.ããWas HLA (High Level Assembly) one of those? I did look into it, but I alwaysãpreferred to be explicit about the instructions I used. When I use assembler,ãit is because I am targetting an explicit instruction set and want to make theãdecisions about which instructions to use myself. The one time I thought aã"generic" solution would be useful is when I want assembler that runs on bothã32bit and 64bit Intel natively.ããOtherwise, I just use C as my generic assembler, with intrinsics where need be.ãã... Overtly resist changeã--- MultiMail/Linux v0.52ã þ Synchronet þ MS & RD BBs - bbs.mozysswamp.orgã
Boraxman wrote to Dr. What <=-ãã Bo> Was HLA (High Level Assembly) one of those? I did look into it, but Iã Bo> always preferred to be explicit about the instructions I used. When Iã Bo> use assembler, it is because I am targetting an explicit instructionã Bo> set and want to make the decisions about which instructions to useã Bo> myself. The one time I thought a "generic" solution would be useful isã Bo> when I want assembler that runs on both 32bit and 64bit Intel natively.ããI never really got into assembly language other than to know it was there. ãI've learned much more as I've been doing more research into the history ofãPCs.ããI went from BASIC as a kid, straight to FORTRAN, Pascal, LISP, C and more.ããI think I did one class in Univac assembly in college. But it was mainly toãknow what was happening "under the hood" when we worked in the higher levelãlanguages.ããI did work on some FORTRAN programs for GM 20+ years ago that used an assemblyãlanguage subprogram that was self-modifying. The computer had a fancyãinstruction they needed to use, but the assembler didn't support it, so theyãwrote their subprogram to modify itself to use the fancy instruction the firstãtime it was called.ããAssembler was mostly frowned upon in my work because of the time and resourcesãit took to use it. People time was more expsensive than computer time.ããã... I'm spending a year dead for tax purposes.ã--- MultiMail/Linux v0.52ã þ Synchronet þ Diamond Mine Online BBS - bbs.dmine.net:24 - Fredericksburg, VA USAã
Dr. What wrote to Boraxman <=-ãã -=> Boraxman wrote to Dr. What <=-ãã Bo> Was HLA (High Level Assembly) one of those? I did look into it, but Iã Bo> always preferred to be explicit about the instructions I used. When Iã Bo> use assembler, it is because I am targetting an explicit instructionã Bo> set and want to make the decisions about which instructions to useã Bo> myself. The one time I thought a "generic" solution would be useful isã Bo> when I want assembler that runs on both 32bit and 64bit Intel natively.ãã DW> I never really got into assembly language other than to know it wasã DW> there. I've learned much more as I've been doing more research into theã DW> history of PCs.ãã DW> I went from BASIC as a kid, straight to FORTRAN, Pascal, LISP, C andã DW> more.ãã DW> I think I did one class in Univac assembly in college. But it wasã DW> mainly to know what was happening "under the hood" when we worked inã DW> the higher level languages.ãã DW> I did work on some FORTRAN programs for GM 20+ years ago that used anã DW> assembly language subprogram that was self-modifying. The computer hadã DW> a fancy instruction they needed to use, but the assembler didn'tã DW> support it, so they wrote their subprogram to modify itself to use theã DW> fancy instruction the first time it was called.ãã DW> Assembler was mostly frowned upon in my work because of the time andã DW> resources it took to use it. People time was more expsensive thanã DW> computer time.ããI went straight from Basic to Assembler. Mostly because I wanted to writeã'machine code' for a while, and at the time, that is what I got, an assembler. ãDidn't have a C compiler or anything like that. It was slow going to developãstuff, especially when it was so easy to hard lock the computer, and this wasãon a machine without a reset button. So I would have to turn it off and on toãreset.ããBut it IS fun, and even recently I've enjoying doing some simply assemblerãstuff for Linux, the Vic 20 and for DOS. Something satisfying about havingãcomplete control of the hardware, playing with hardware interrupts, being ableãto account for every byte, self modifiable code.ãã... MultiMail, the new multi-platform, multi-format offline reader!ã--- MultiMail/Linux v0.52ã þ Synchronet þ The Horizon bbs - bbs.horizonbbs.orgã
Sysop: | Karloch |
---|---|
Location: | Madrid, Spain |
Users: | 52 |
Nodes: | 8 (0 / 8) |
Uptime: | 53:40:42 |
Calls: | 715 |
Files: | 17,895 |
D/L today: |
2 files (10,523K bytes) |
Messages: | 65,411 |