From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,HK_RANDOM_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a1a88c4d509f6381 X-Google-Attributes: gid103376,public From: czgrr Subject: Re: scope and/or parameters (beginner) Date: 1999/04/15 Message-ID: <7f46ij$vfo$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 466622939 References: <37064309.889106243@news.dsuper.net> <37084459.8616007@rocketmail.com> <370b0c99.1137352783@news.dsuper.net> <7ei04q$o$1@nnrp1.dejanews.com> <7et4vr$sdj$1@nnrp1.dejanews.com> <7euskv$d91$1@nnrp1.dejanews.com> <7evbei$opm$1@nnrp1.dejanews.com> <7f1jce$nt4$1@nnrp1.dejanews.com> <7f23j5$4mu$1@nnrp1.dejanews.com> X-Http-Proxy: 1.0 x17.dejanews.com:80 (Squid/1.1.22) for client 193.192.234.4 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Thu Apr 15 08:04:38 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT) Date: 1999-04-15T00:00:00+00:00 List-Id: In article <7f23j5$4mu$1@nnrp1.dejanews.com>, Robert Dewar wrote: [Snip everything, just for space, really; read the post if you want details] To quote Chandler from "Friends": "Can open, worms everywhere!" You are correct, the test gives a very limited conclusion, it is flawed in many ways, etc, etc. I did not intend that example to be suitable code, but just to show my point - which it did, in that on *my* implementation, with *my* setup and with the very example-specific code shown, I got a result which was much different from yours, and which was not as expected. However, and I say this as my last posting to this thread... There is a large, real-time critical program which worked fine. Then it was ported from one machine to another without any code changes and suddenly had a serious performance problem. Moving locally declared, generic-based packages to global scope, and also some large arrays, just like in the example I gave, solved the problem, and that is all that was changed. Now there are many factors, which you have touched upon in your last post, which may have caused the problem, but this was "real" code, in a "real" environment. I couldn't produce that exact code for you to try on your machine because a) there would be too much of it, b) I do not own the copyright, and anyway c) I don't work for that project any more. So I'm afraid I/we will never know the exact or "true" reason for the difference in performance. But it worked. The problem was fixed by a single change without affecting functionality. The customer and the project were happy. The code is more portable as a result, because it depends just that little bit less on the environment in which it is run. And making the same change to the code on the original machine had no visible effect on that, either, so why not code it like that to begin with? Ever since then, when I have the same sort of situation with very large arrays, etc, I always make them global. It is less logically correct, yes, it may not be necessary *in that environment*, yes, but it had fixed a bug and I learned from it. And when someone on a discussion forum asks a related question, I give my opinion, based on my experience, and that is all I can give. It is up to the readers of this thread to make their own choice as to how they would code a particular situation, and I have had my say, you have had yours, and that the end of the story. All the best, czgrr -- My opinions, suggestions, etc, are not necessarily those of my employer. They might not even be right. Use at your own risk. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own