View Single Post
Old 29 December 2023, 15:02   #3
SpeedGeek
Moderator
 
SpeedGeek's Avatar
 
Join Date: Dec 2010
Location: Wisconsin USA
Age: 60
Posts: 842
Quote:
Originally Posted by Karlos View Post
Most applications don't fit either category since copying large amounts of data around is generally considered "a bad thing" (tm), and equally, frequently copying smaller items around (e.g. implementing by value semantics for structure passing) is not considered a "good thing" and even where compiled code does this, for most typical structures, it's faster and simpler to directly emit a few unrolled move instructions in order to duplicate a typical C structure from one location to another, than it is to do a library call to exec.
I've observed that what most applications should or should not do is often irrelevant. They tend to do whatever their developers want them to do and that's that.

The reason why Commodore included these functions in the exec.library was to provide the most efficient use of the most commonly used functions. Since the library is always open and referenced at a specified location, it avoids the extra overhead of opening and closing the library.

Whether or not a C compiler can duplicate structures more efficiently with internal functions was another decision made by the developer of that particular C compiler. I do most of my coding projects in assembler and with the projects I have done, I have referenced structures but I had no particular need for duplication.

Getting back to a more general discussion, I think C coders can realize just as much as ASM coders that calling Copymem() for <= 4 bytes is very inefficient (a definite should not do) but there are some lazy coders who will do that anyway.

Last edited by SpeedGeek; 29 December 2023 at 15:10.
SpeedGeek is offline  
 
Page generated in 0.04551 seconds with 10 queries