Caution when reading arrays stored in Application and Session variable

Caution when reading arrays stored in Application and Session variable

One of the most effective optimization techniques consists of caching data inside Application or Session variables. However, you should pay attention to how you reference to the elements in those arrays from an ASP page. In fact, the syntax of VBScript (and JavaScript as well) lets you reference elements in those arrays as follows:

' read the first elementResponse.Write Application("mydata")(0)' read the second elementResponse.Write Application("mydata")(1)' etc.

Alas, when you do so VBScript makes a copy of the entire array and then extracts the requested element, and then discard the temporary copy. If the array is large, this causes a sensible overhead, in terms of memory allocation and deallocation. You can avoid these unnecessary operations using an explicit local variable:

Dim arr' read the array in a local variablearr = Application("mydata")' read the elementsResponse.Write arr(0)Response.Write arr(1)' etc.

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved