#119439 - 2004-05-13 04:35 PM
Re: using a central udf file
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
But is there a practical limit as to how large I should let it become?
Yup, when it becomes impractical to maintain, you've exceeded the practical limit.
There are a couple of consideration that would make you break down the file into smaller libraries.
The first is simply maintenance. It is unhandy having to edit a file with hundreds of functions in it, or to search through for a function who's name you've forgotten.
More important though, is that every file that you load is parsed. This happens when you "CALL" the file, and the entire file is parsed - not just the functions that you want to use.
Often the longest part of running a script is reading it from the network share and parsing it.
For this reason it makes sense to categorise you UDFs and store them in discrete libraries. You only need to call in the libraries that contain the functions you are going to use, saving memory and cpu.
For instance, I have seperate libraries for
- Logging UDFs
- Internationalisation UDFs
- String handling UDFs
- Email UDFs
- Network calculation UDFs
- Time and date UDFs
- Specific application UDFs
And so-on.
There are no more than 6 small functions in each of these, so they are quite quick to load and parse.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Henriques)
and 2516 anonymous users online.
|
|
|