Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Is it always possible to write a COBOL program using only 1 sentence per paragraph?
"Pete Dashwood" <dashwood@enternet.co.nz> wrote in message
news:3k86utFl4gssU1@individual.net...
>
> "Clark Morris" <cfmtech@istar.ca> wrote in message
>  news:e1atd11fi2cshuqsgg11l78qp1n840102p@
4ax.com... 
> <snip>>> 
>
> Yes, necessarily. :-)   Three factors affect online performance; two of
them
> are load time and capture time. The smaller  and tighter a module is, the
> quicker it loads and it will be likely to require less capture time.
>
> Capture time for a process will be improved if there is less code for the
> process to execute (as long as it provides the same functionality, of
> course.)
>
> Adding code cannot possibly make it execute any faster than it is required
> to. And if everything else is equal, the faster load time of a smaller
> module makes overall execution quicker.  If a small module is being paged
in
> and out continually, as opposed to a large resident piece of code, then
the
> overall execution of the small module functionality may be longer, but
that
> implies that the large piece of code is doing more (otherwise, why is it
so
> large?), so the comparison is between apples and oranges
>
> Given identical functionality and identical residence, the smaller the
code
> is, the quicker it will execute. Invariably.

Perhaps, Mr Dashwood, you had some additional restrictions
in mind; but there are cases where larger code, with 'identical
functionality', will execute faster.

The following program has two procedures to determine the
length of text (a string). The procedures have 'identical functionality',
in that they each accept a 32 character item and return its length
(the position of the last non-space character). They also function
identically by examining the 32 character item, in reverse, one
character at a time. Yet the larger procedure outperforms the smaller.

Test program
--------
program-id. unroll.
data division.
working-storage section.
1 str pic x(32) value space.
1 strlen-1 comp-5 pic 9(4) value 0.
1 strlen-2 comp-5 pic 9(4) value 0.
1 time-1.
2 time-1-hour pic 99.
2 time-1-minute pic 99.
2 time-1-second pic 99v99.
1 time-2.
2 time-2-hour pic 99.
2 time-2-minute pic 99.
2 time-2-second pic 99v99.
1 time-3.
2 time-3-hour pic 99.
2 time-3-minute pic 99.
2 time-3-second pic 99v99.
1 elapsed-time pic 9(7)v99.
1 elapsed-time-display pic z(6)9.99.
procedure division.
mainline section.
move spaces to str
perform time-test
move 'a' to str (16:1)
perform time-test
move 'a' to str (32:1)
perform time-test
stop run

Report this thread to moderator Post Follow-up to this message
Old Post
Rick Smith
07-25-05 03:01 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:55 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.