|
Leif Any idea how much slower this would be in RPG? d TheString s 50 d TheShorter s 50 inz('TEST STRING') d Nbr s 6s 0 c do 100000 Nbr c evalr TheString = %trim(TheShorter) c enddo c return Ken Slaugh (707) 795-1512 x118 Chouinard & Myhre, Inc. AS/400 Professional Administrator/MSE Client Access Specialist http://www.cm-inc.com/ "Leif Svalgaard" <leif@leif.org> To: <MIDRANGE-L@midrange.com> Sent by: cc: owner-midrange-l@mi Subject: Re: Web apps on the AS/400 drange.com 03/18/01 06:20 PM Please respond to MIDRANGE-L From: Leif Svalgaard <leif@leif.org> > From: Nathan M. Andelin <nathanma@haaga.com> > > >Java is better for vector and string manipulation than RPG... > > I don't disagree with the above statement. It's just that it's ealily > > remedied > > These blanket statements are hard to accept at face value. > The only way to verify this is to solve the same string problem > in different languages and them to time the following things: > 1) how long did it take to solve the problem > 2) how fast does it run. (do it 100,000 times) > > So here is a sample problem: > > Given a string of length 50, move a shorter string to it, > e.g. "test string", finally right-justify the string, so that it > now holds: > " test string" > The shorter string is not known at compile time. > > Once we have a solution to that in several languages > we can make meaningful comparisons. If the language > or a subroutine library already has a function that solves > the problem, you are not allowed to use it. > This later restriction is somewhat dubious: imagine > you had a language that had a built-in solution to > every problem your are likely to encounter, it is > hard to disqualify using it. > Here is one solution (in MI on a 150 box): time to write: 4 min time to run 100,000 times through the loop: 1.3 secs code: DCL DD THE-STRING CHAR(50); DCL DD THE-SHORTER CHAR(50); DCL DD SIZE BIN(2); DCL DD START BIN(2); DCL DD NBR BIN(4); CPYBLAP THE-SHORTER, "TEST STRING", " "; CPYNV NBR, 100000; AGAIN: TRIML SIZE, THE-SHORTER, " "; CMPNV(B) SIZE, 0/HI(=+2); CPYNV SIZE, 50;: SUBN START, 51, SIZE; CPYBRAP THE-STRING (START:SIZE), THE-SHORTER, " "; SUBN(SB) NBR, 1/POS(AGAIN); RTX *; +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.