devxlogo

Convert Static Variables for More Speed

Convert Static Variables for More Speed

Referencing a static local variable in a procedure is two to three times slower than a regular local, dynamic variable. If your procedure demands every last bit of speed possible, convert all static variables into module-level variables.

However, this approach has a nasty design implication?the procedure becomes less self-contained. You must remember to copy and paste the module-level variable when you reuse the procedure in another project. But this approach might make sense in an extremely intense routine. Further, referencing a variable declared at module level is faster than referencing a global variable declared in a separate BAS module. If you don’t need to share a variable among all of an app’s forms and modules, you should declare it in the only form or module that uses it.

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist