|
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 +---
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.