Why PUP Is Modular
I got an email this morning about PUP:
This is more a question of philosophy than anything else: is there any particular reason (other than size) that you decided to assemble the PUP utility as a number of individual add-ins, rather than one large one?
My reply:
The primary reason was size. It would be a HUGE add-in and gigantic memory hog if it were all in one file. And besides, most users only use a few of the utilities. Plus, because it's modular I can provide bug fixes and updates to a single module rather than requiring the user to download the entire file again. And finally, it's just much easier to work on small pieces.
The original version of PUP, developed back in 1994, was contained in a single file. But I added so many new features to PUP v2, that I had to figure out a way to use less memory. So I wrote code in the main add-in file that loads the other add-ins when needed. This memory management was improved in PUP v5, with a method to let the user specify the maximum number of PUP utilities to remain in memory (the default is three). The utility files are closed on a first-in-first-out basis. When a new utility is loaded (and the maximum number would be exceeded), the "oldest" one is unloaded.
- Reader Comments -
Following are comments in response to this item.
The most recent comment is at the bottom.
- By Scott. Comment posted 09 September, 2008 12:56pmSo, to follow up on this thread, why do you keep a certain number of tools open (three is the max for PUP6), rather than shut the tool down once it's action is complete?
Is there a benefit (speed, etc.) to keeping an add-in open that may be called again, rather than opening, using, and closing? - By John Walkenbach. Comment posted 09 September, 2008 3:06pmIf someone uses the same utility over and over, there's probably a slight speed benefit by not having to load it from the disk every time. When designing this, my thought process went something like this:
1. If someone uses the same utility multiple times, keep it open
2. I don't want to leave them all open.
3. How many should I leave open?
4. I have no idea
5. Let the user decide
BTW, PUP v6 doesn't have a max of 3. You control the number in the PUP Options dialog.
Spreadsheet Page Blog
Welcome to the Spreadsheet Page Blog. This is where you find the latest news on my books, add-ins, and other Excel-related topics. Comments are welcome.