![]() | |
#11
| |||
| |||
|
|
1) Open what you need when you need it, 2) but open what you know you are going to need up-front. |
|
Hello Group, Is there a disadvantage to OPEN all files when a user logs in? Would there be a relationship or formula based on the system memory? Thanks, -Peter G. |
#12
| |||
| |||
|
|
Ok Guys, My original question was asked get opinions. I was thinking that if I redesign a MV package to be all SUBROUTINEs modular, I would be opening the same files left and right. This may not be noticed on a system with 100 users using terminals. But if I use those same SUBROUTINEs in a background process or an overnight process with millions of records, then it will have a big impact. After reading these opinions, I'm leaning more that OPENing all files is the best solution. Hardware speed is becoming less of an issue these days. Thanks for the opinions and I'll report any pit falls that may arise. -Peter G. |
#13
| |||
| |||
|
|
I suspect that you're really only doing the "expensive" read once, and the next 9,9999 times the code takes a "shortcut." |
#14
| |||
| |||
|
|
Hi Peter, I think it is a myth that file opens are expensive. Try this: :ct bp open.test * * open.test 001 t = time() 002 for n = 1 to 10000 003 * open "sb.temp" to sb.temp else stop 201,"sb.temp" 004 next n 005 print time()-t On D3 or UV, you can open a file 10,000 times in less than a second. I would argue that: A) If your program is slow it's not because you are (re-) opening the same files too many times, and B) whatever the minuscule speed advantage you may gain from either opening all files at once, or caching the opens in common, you will loose more in increased complexity and opportunity for confusion, and C) if you implement your "open all files once" scheme via a standard subroutine call, the CALL itself is probably more expensive than the OPEN. That being the case, Tony's rule-of-thumb: 1) Open what you need when you need it, 2) but open what you know you are going to need up-front. ... is the best approach. Just my opinion. /Scott Ballinger Pareto Corporation Edmonds WA USA 206 713 6006 On Jan 29, 5:58*am, mdsi2000 <mdsi2... (AT) yahoo (DOT) com> wrote: Hello Group, Is there a disadvantage to OPEN all files when a user logs in? Would there be a relationship or formula based on the system memory? Thanks, -Peter G. |
#15
| |||
| |||
|
|
Hello Group, Is there a disadvantage to OPEN all files when a user logs in? Would there be a relationship or formula based on the system memory? Thanks, -Peter G. |
#16
| |||
| |||
|
|
On Jan 29, 3:58*pm, mdsi2000 <mdsi2... (AT) yahoo (DOT) com> wrote: Hello Group, Is there a disadvantage to OPEN all files when a user logs in? Would there be a relationship or formula based on the system memory? Thanks, -Peter G. I think it would depend on the MV platform and O/S that you are using. Certainly in UV you'd need to tweak some parameters depending on your estimates of number of users and number of files. |
#17
| |||
| |||
|
|
If you have all of your I/O going through the same subroutine(s) you can maintain a dynamic array of open file names (which really should be resolved down to the full path) and an associated dimensioned array of file variables. This way you don't need to worry about opening files in your application code - ever - and you can reference files by name rather than by file variable. But surely you'd need to include all the file variables in a common |
#18
| |||
| |||
|
|
On Feb 7, 8:10*am, Bob Dubery <megap... (AT) gmail (DOT) com> wrote: On Jan 29, 3:58*pm, mdsi2000 <mdsi2... (AT) yahoo (DOT) com> wrote: Hello Group, Is there a disadvantage to OPEN all files when a user logs in? Would there be a relationship or formula based on the system memory? Thanks, -Peter G. I think it would depend on the MV platform and O/S that you are using. Certainly in UV you'd need to tweak some parameters depending on your estimates of number of users and number of files. If you have all of your I/O going through the same subroutine(s) you can maintain a dynamic array of open file names (which really should be resolved down to the full path) and an associated dimensioned array of file variables. This way you don't need to worry about opening files in your application code - ever - and you can reference files by name rather than by file variable. The time needed to do a locate of the file name in your dynamic array to pick up the relevant file variable is negligible. You will only ever open a file once - the first time it is used. Also - a world of possibilities open up... Think of triggers fired when you perform a write (which you're familiar with), then think of similar capabilites on reads... etc. You can also venture into the world of data-abstraction - along the lines of jBASE's jEDI (or whatever it was renamed recently). |
#19
| |||
| |||
|
|
From what you are saying, the problem lies not with the feature, but with the people that developed it. |
|
We have always used COMMON in our business software, and use Global Common within Visage |

#20
| |||
| |||
|
|
On Feb 14, 5:35*pm, Ross Ferris <ro... (AT) stamina (DOT) com.au> wrote: From what you are saying, the problem lies not with the feature, but with the people that developed it. Isn't this usually the case? *Many languages have features, such as global variables, but using them is widely considered poor programming practice. *Persistence of common variables across accounts, in D3 anyway, leads to even greater risks. We have always used COMMON in our business software, and use Global Common within Visage Yes, but you have been around since the beginning of your software development, so I imagine you have a solid understanding of how Common is used throughout your systems. *Many of us are not so lucky. Since Pick was geared towards "business people" being able to build their own information systems with little background or skill in computer programming, that's exactly what you got a lot of the time. I found an old CDP thread from 2001, that I started, regarding the use of common blocks. *It seems people still feel the way they did 9 years ago. ![]() http://groups.google.com/group/comp....se_frm/thread/... There are the names of some people that I miss around here in that thread. -- Kevin Powick |
![]() |
| Thread Tools | |
| Display Modes | |
| |