Decompile then Deploy
Save disk space and increase startup performance of your program updates by running /decompile before deployment.
Many of my readers will be familiar with the undocumented
/decompile command line flag. Running Access with this flag and the name of an Access database will strip the compiled "P-Code" from the Access file.
Most developers use this as a way to recover from corruption. It's obviously well-suited for that. Out of sync VBA source code and compiled P-Code is a major source of corruption in Access databases.
I like to use it in another way, though. Over the past six months or so, I've started running the following command prior to deploying my projects*:
msaccess.exe MyFrontEnd.accdb /decompile /compact /repair
The decompile flag strips out the P-Code. The compact and repair flags recover any available space from internal tables.
Why do I do this? Two main reasons: disk size and startup performance.
Stripping out the P-Code and compacting the .accdb file results in the smallest possible file size for my projects. As I'm usually uploading these files to a web server or copying them to a client server via a VPN, the reduced file size speeds up the process.
This also improves the end user experience, as updates are downloaded faster.
Most of my end users are not using the exact same version of Access that I develop with. Without me explicitly decompiling my project, the decompile would happen on the user machine.
Here's the typical sequence:
- Open the updated .accdb file
- Access checks what version of Access compiled the code
- If the versions differ, Access removes the P-Code from the updated .accdb
- Access compiles new P-Code from the .accdb's source code
By decompiling the .accdb before distributing, I save the user from having to perform Step 3 above the first time they run the new version. This usually shaves a few seconds off the startup time. While that may seem trivial, I often get phone calls after I distribute a new version of one of my programs because, "Something must be wrong...it took longer than usual to open." Decompiling saves me those phone calls.
* I do not distribute compiled .accde or .mde files to my users. My reasons for that are beyond the scope of this article.
Image by Free-Photos from Pixabay