flat assembler
Message board for the users of flat assembler.

Index > Main > Grasping the idea of assembly taking up linearly more code.

Author
Thread Post new topic Reply to topic
asmblr_88



Joined: 12 Jan 2023
Posts: 12
asmblr_88 19 Jun 2023, 13:40
I am now wondering about a youtube comment I read a couple of days ago regarding assembly and C, someone said (and I paraphrase) assembly doesn't take exponentially more code than C, it just takes linearly more code to write.

I didn't fully understand it, but I am thinking is it how it takes in and processes the bits? Like the ordering of syntax?

So I guess my question is what does it mean for assembly to take up linearly more lines of code than C?

Also does assembly language perform mathematical operations using a reverse polish notation as Forth?

Is this the right place in the forums to ask that question or should I ask it in a different thread?

_________________
asmblr_88
Post 19 Jun 2023, 13:40
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4046
Location: vpcmpistri
bitRAKE 19 Jun 2023, 14:58
Unsure what the original YouTube comment intended, but I can share some thoughts on the matter ...

I would say that any language can efficiently [by length] code a problem that fits that language's model for computation. Even assembly languages have different paradigms. Implementing a problem in a language is a function of the programmer. What this means is that experience and understanding improves one's ability to express problems in a language.

Take the typical computer science problem of expressing a function to compute the Fibonacci sequence. It really doesn't apply to x86 because it's a single instruction, XADD. [Usually, the problem is trying to demonstrate something else (i.e. recursion, memorization, ...).] But most programming languages lack that instruction, and/or use a different model for computation. It's important to be able to express a problem in different models of computation.

The same can be said for spoken/written languages. They can include a lot of context inherent in the phrasing.
Quote:
Limited human growth rate ensures we are all indoctrinated to some extent into the culture and communities of our upbringing.


As for RPN, there are efficiencies in using that model for computation - both in data structure and operations - which seem to mesh well with assembly, but RPN is not inherently assembly related, imho. Using RPN explicitly in assembly would mean imposing a constraint on one's assembly coding to the RPN model.

I can also imagine this question in "High Level Languages" or "Programming Language Design" ... guess we'll need to see where the conversation goes ...

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup


Last edited by bitRAKE on 19 Jun 2023, 16:09; edited 2 times in total
Post 19 Jun 2023, 14:58
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 19 Jun 2023, 15:03
Linear just means a simple multiplier.

So C_CODE * multiplier == ASM_CODE

So the question becomes "What is the multiplier?"

Is it 0.1? Or pi? Or 666?
Post 19 Jun 2023, 15:03
View user's profile Send private message Visit poster's website Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2519
Furs 20 Jun 2023, 13:29
revolution wrote:
Linear just means a simple multiplier.

So C_CODE * multiplier == ASM_CODE

So the question becomes "What is the multiplier?"

Is it 0.1? Or pi? Or 666?
The multiplier isn't important, it's the growth. What linear means is that there's a specific amount of asm code for each C code, no matter how large the C code is.

Exponential would mean the more C code you write, the more and more and more asm code you'll have to write for it (which is nonsense). So even if 5 lines of C code can be done in 15 lines of asm, you'd need 1000 lines of asm for 20 lines of C code, etc. That's the exponential idea.

This is just hypothetical example with random numbers.
Post 20 Jun 2023, 13:29
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot 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


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.