|
You might try converting the malloc and free() functions to a User Space. Create the user space in QTEMP, then get a pointer to it. The use the user space as you would regular memory/storage. The user space will (optionally) automatically extend as needed. I've found (in RPG IV at least) that the User Space technique for dynamically sized arrays is no perceivable difference in memory access and in realloc() comparisons seems faster. That is the auto-extend feature seems to be faster than realloc(). -Bob Cozzi -----Original Message----- From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l-bounces@xxxxxxxxxxxx] On Behalf Of c400-l-request@xxxxxxxxxxxx Sent: Wednesday, June 30, 2004 12:00 PM To: c400-l@xxxxxxxxxxxx Subject: C400-L Digest, Vol 2, Issue 34 Send C400-L mailing list submissions to c400-l@xxxxxxxxxxxx To subscribe or unsubscribe via the World Wide Web, visit http://lists.midrange.com/mailman/listinfo/c400-l or, via email, send a message with subject or body 'help' to c400-l-request@xxxxxxxxxxxx You can reach the person managing the list at c400-l-owner@xxxxxxxxxxxx When replying, please edit your Subject line so it is more specific than "Re: Contents of C400-L digest..." Today's Topics: 1. Porting C Linux to ILE C: Performance problem (Zvi Kave) 2. RE: Porting C Linux to ILE C: Performance problem (Bob Crothers) ---------------------------------------------------------------------- message: 1 date: Wed, 30 Jun 2004 07:29:10 -0700 (PDT) from: Zvi Kave <zvi_kave@xxxxxxxxx> subject: [C400-L] Porting C Linux to ILE C: Performance problem Dear collegues, 1. I ported succesfully(?) C coded software from Linux to ILE C. 2. The sample program I use, takes in Linux 1 second. The same program run takes on the AS/400 ... 7 minutes!? 3. When debugging the program on the AS/400, I found that the slow response is in the memory allocation routines, namely, calloc, malloc, realloc and free(). CPU usage is about 10%. 4. Those memory management routines are managed by linked list which is allocated in the beginning of program and free()d before end. Is there any reason for that performance problem? Please help. Regards, Zvi __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------ message: 2 date: Wed, 30 Jun 2004 09:40:12 -0500 from: "Bob Crothers" <bob@xxxxxxxxxxxxxx> subject: RE: [C400-L] Porting C Linux to ILE C: Performance problem Realloc is always a poor performer as it needs to allocate a new block large enough to fit the request, then copy the memory from the old location to the new one and then return. As a general rule, I try and limit the malloc's and free's that a program uses as much as possible. They tend to be expensive and make performance very non-linear. This is both AS/400 and Windows. Havent done much Linux/Unix work so I don't know about that. Bob > -----Original Message----- > From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l-bounces@xxxxxxxxxxxx] On > Behalf Of Zvi Kave > Sent: Wednesday, June 30, 2004 9:29 AM > To: c400-l@xxxxxxxxxxxx > Subject: [C400-L] Porting C Linux to ILE C: Performance problem > > Dear collegues, > > 1. I ported succesfully(?) C coded software from Linux > > to ILE C. > 2. The sample program I use, takes in Linux 1 second. > The same program run takes on the AS/400 ... > 7 minutes!? > 3. When debugging the program on the AS/400, I found > that the slow response is in the memory allocation > routines, namely, calloc, malloc, realloc and > free(). > CPU usage is about 10%. > 4. Those memory management routines are managed by > linked list which is allocated in the beginning of > program and free()d before end. > > Is there any reason for that performance problem? > > Please help. > > Regards, > > Zvi > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > This is the C programming iSeries / AS400 (C400-L) mailing list > To post a message email: C400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/c400-l > or email: C400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/c400-l. ------------------------------ _______________________________________________ This is the C programming iSeries / AS400 (C400-L) digest list To post a message email: C400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/c400-l or email: C400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/c400-l. End of C400-L Digest, Vol 2, Issue 34 *************************************
As an Amazon Associate we earn from qualifying purchases.
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.