|Efficient is a subjective word. It often is used in the place of fast or sometimes associated with less memory or throughput. Performance is a also often used as well.
None of those mean anything without a context. A medical monitor, a CRC controller and a facebook page are vastly different things and performance means something different for all of them.
In general and almost always the following is what impacts this
1. Business requirements (highest)
4. Implementation (lowest). This also includes adhoc designs that were done without thinking.
It has been proven that developers do not predict impactors on performance when based solely on the implementation level and without profiling. The other levels require human skill.
Optimizations at the first level are capable of having orders of magnitude impacts on the performance of systems. The impact goes done significantly at each level. At the bottom level implementation improvements are unlikely to improve the system by more than 10% unless the a factor comes into play that is actually better addressed by a failure in the levels above it.
primem0ver wrote:I can think of one possibility using unsafe copying but was wondering if I had any other better (more efficient) options.
The memory mapped variables that you are referring to are "unsafe" because, as proven by decades in C++/C that programmers use them wrong, especially over time. And those failures lead to application crashes. Not just small annoyances but rather problems that make the OS terminate the application immediately. Often in ways that seemingly have nothing to do with where the actual bad code is.
So presumably the need for efficiency is real one. One that has been measured. One that is not actually a failure from one of the other levels.
So if a real need exists and one that has been localized, measured, and designed such that such an optimization can improve something in the enterprise, then as suggested elsewhere use C/C++. Then map away. And if was me I would create a separate executable with just that code. Then when the exe crashes it will not take the rest of the enterprise down.