More performatic way of working with Request in Classic ASP?

1

I'm working on a webpage that uses Classic ASP and I was left with a question, How do I store the value of a request in a variable to improve performance when compared to getting the request ("value") over the code?

Is it better this way?

if Request("valor") > 0 AND cond1 Then
   ...
Elseif Request("valor") < 0 AND cond2 Then
   umaVar = Request("valor") + 2
End If

Or so

Dim dblValor : dblValor = Request("valor")
if dblValor  > 0 AND cond1 Then
   ...
Elseif dblValor  < 0 AND cond2 Then
   umaVar = dblValor  + 2
End If

Or is there no difference?

EDIT: A motivation for doubt: When we send n data to capture with the request, among them the "value", when making the Request call ("value") I have a unique memory address to be queried or there is something similar to a list or dictionary that the application needs to go through, at worst n records, every time the call is made? I do not know how the behavior of the request works but I found that ASP does a * search to know if it is a Request.Form, or Request.QueryString, and so on, but what about storing those values?

* link

    
asked by anonymous 22.02.2017 / 14:44

1 answer

0

Much better to assign request() to a variable:

variavel = request("variavel")

In addition to the code getting leaner, it is much better to work with the data received, especially if you need to treat them:

variavel = trim(replace(replace(request("variavel"),"'",""),"_",""))

Imagine having to repeat trim(replace(replace(request("variavel"),"'",""),"_","")) each time you want to get request() ? What if you want to change the way you treat request() ? I would have to change all the code. Using a variable for request() this becomes much simpler.

    
20.08.2017 / 02:49