And I've discovered that my Zerofill routine, which can be given any number of leading zeroes, never gets called with anything other than 2 leading zeroes. I discovered that by changing 'watch "Zerofill"' to 'watch "Zerofill." & nWidth'. Zerofill gets called > 700,000 times in a session.
So I create a new version of Zerofill
which I call Zerofill2
and get a slight speed-up
Past (20 years or so) and present code. A variety of languages and platforms. Some gems. More gravel. Some useful stuff and some examples of how not to do it.
Showing posts with label Watcher. Show all posts
Showing posts with label Watcher. Show all posts
Tuesday, September 27, 2005
[VBScript] "Watcher" - on the way to code profiling ... sort of
I've just implemented a new class, Watcher, which is giving me an idea of what routines in my stdFunctions.vbs are actually being used, and how frequently.
At present the class depends on some of the routines it would otherwise be watching so those routines can't refer to Watcher until such time as I make the class self-contained.
The class gets instantiated in the usual way right at the start of my stdFunctions.vbs file and then at the beginning of each of the subs and functions in stdFunctions.vbs there is a reference to watch, e.g. When the class terminates the data is saved in Watcher.txt as lines of tab-delimited text, for example: and these are then read back in at the initialisation of class next runtime round.
If you find this useful please let me know. Code below.
At present the class depends on some of the routines it would otherwise be watching so those routines can't refer to Watcher until such time as I make the class self-contained.
The class gets instantiated in the usual way right at the start of my stdFunctions.vbs file and then at the beginning of each of the subs and functions in stdFunctions.vbs there is a reference to watch, e.g. When the class terminates the data is saved in Watcher.txt as lines of tab-delimited text, for example: and these are then read back in at the initialisation of class next runtime round.
If you find this useful please let me know. Code below.
Labels:
class,
profiling,
StandardLibrary,
VBScript,
Watcher
Subscribe to:
Posts (Atom)