Re: Does 32 bitter code pack less efficiently than 16 bitters?



Hi John,

John Speth wrote:

What is the real world comparison of 16 bit vs. 32 bit code footprint among popular professional grade MCU cores and tools?

Thanks in advance for your discussion.

As you would expect, there is no "real" comparison to be
made, here. The problem lies in deciding "what's an apple"
(let alone, an "orange"!)

What you have to look at is how long *instructions* are,
not the "size" of the processor. E.g., if every instruction
for the "32 bit" processor is exactly one "(32b) word" but
the "16b CPU" often needs two or three "(16b) words", then
the average instruction in the 16b case is longer.

[Of course, "average" can be defined a lot of ways!]

You can **naively** try to get an idea for the relative
efficiencies of various architectures by cross-compiling a
"large-ish" project for each and looking at the sizes of
the resulting (stripped) binaries.

But, this is truly a naive approach because it assumes:
- you have compilers for each architecture
- the compilers are "equally good" at code generation
- there are no variations in data types, etc. across
platforms (e.g., 32b ints in one, 16b ints in the other)
etc.

However, a more insidious issue regards how well the
"application" *fits* the particular implementation (CPU).
E.g., if you are dealing with IP addresses, then the
ability to handle 32b values economically can give
preference to a 32b architecture. OTOH, if you are
processing strings or other small data types, the
overhead that comes with a 32b CPU may represent a
lot of waste.

In "the real world" (per your query), you fit the
implementation to the application (C.A.E typically
having less "spare resources" than the desktop world).
Or, modify the application to fit the implementation
available (!).

In my own *personal* experience, I have found 16b
implementations tend to use 40-50% more "resources"
than "equivalent" 8b implementations. The same sort
of ratio (ballpark) applies to 16b vs 32b.

BUT, THIS IS JUST A ROUGH GUIDELINE. I use it to
gauge the approximate cost of moving up/down the
"wideness" hierarchy (or should that be "left/right"?)
when a project looks like it may straddle a particular
"decision point" (e.g., something that taxes the
abilities of a 16b -- but would underutilize those of
a 32b, etc.).

In actuality, once the decision is made to cross such a
threshold, the scope of a project is often adjusted,
accordingly. E.g., adding features/capabilities if
moving upwards; removing/reducing if moving downwards.
(i.e., so the resulting implementation better *fits*
the resources available).

If you are *lucky*, you'll find yourself right smack in the
"center" of a particular technology's capabilities and
won't be faced with this choice: "This is what we *need*.
Anything less won't work; anything more is waste"
.



Relevant Pages

  • Re: FREE! FREE! FREE! All the Unsolicited Advice You Could Ever Want!
    ... of what must mostly fit the bill ... Your attempt to see both sides provides your feat a better fit. ... It's difficult to feel secure when moving at this pace, ... Trust them when they are at their best for all the world to see. ...
    (alt.support.stop-smoking)
  • FREE! FREE! FREE! All the Unsolicited Advice You Could Ever Want!
    ... Your attempt to see both sides provides your feat a better fit. ... Some feel they dare not dream because too much is on their plate. ... Be careful how you choose. ... It's difficult to feel secure when moving at this pace, ...
    (alt.support.stop-smoking)
  • Re: FREE! FREE! FREE! All the Unsolicited Advice You Could Ever Want!
    ... a verse diversion, moving ... ... Your attempt to see both sides provides your feat a better fit. ... Some feel they dare not dream because too much is on their plate. ... Be careful how you choose. ...
    (alt.support.stop-smoking)
  • Re: Oblivion at CES -- looking hotter than before
    ... map size was reduced to fit in the xbox 64MB memory, ... >> frequent loading when moving. ... -- Anderson & Dill makes a Discovery, in 'Video Games and Aggressive Thoughts, ...
    (comp.sys.ibm.pc.games.rpg)
  • Re: BETWEEN
    ... the usability is a byproduct. ... Once you've arranged it to fit the architecture with this ... return false whenever the high bound is below the low bound, ...
    (comp.lang.forth)