× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jevgeni:

To confirm my hypothesis, I made a few small changes to that BENCH.C program, now re-posted as BENCHBCD.C here:

http://code.midrange.com/136eb55598.html

When I run this here, the differences in elapsed time is much worse than just twice as slow -- the C++ version took 24 times longer than the C version -- 8 seconds versus 3 minutes and 16 seconds -- Tis example, dping all of those loops, and dong lots of BCD math, grossly exaggerates the differences between the overhead of procedure/function calls to library routines in ILE C++, versus "in-line" code in ILE C..

Mark

> On 2/16/2015 1:29 PM, Mark S Waterbury wrote:
Jevjeni:

I just noticed near the bottom of your post, where you said:

Program makes a lot of calculations with packed decimal.

There is a big difference in the way ILE C implements support for "packed decimal" as a "native" data type -- versus the way it is "supported" in ILE C++ -- in ILE C, the compiler directly genrerates in-line code (in WCode / NMI) to work on packed decimal data. In the ILE C++ compiler, support for "packed decimal" is through a C++ library called "BCD" -- there are a lot of macros and such defined in the QSYSINC/H include member named BCD ... if you take a peek at that member, I think you will see that this uses "operator overloading" in C++ to trick the compiler into calling the desired library functions when operations are performed on "packed decimal" data.

This difference could easily account for the big differences you are seeing.

And then, you said:

... is there anything that can be done about it?

In C++, you could look into converting the packed decimal data into 64-bit integers, and then performing any calculations using those long integers. This would be much faster than using packed decimal arithmetic, then convert back to packed decimal format, if needed. Or, just stick with ILE C/400 for those programs that require doing a lot of packed decimal arithmetic operations.

Hope that helps,

Mark S. Waterbury



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.