Reading same data frame in a loop in shiny

I am new to Shiny. Suppose I have a function which needs to run in a loop. It takes two inputs, one changes, the other is a data frame hat does not change. To be specific, I will write a simplified function and inputs.

vec1 = rnorm(100)
vec2 = rnorm(100)

input = data.frame(vec1,vec2)

trial1 = function(input){

trial2 = function(n,input){
d = rep(0,n)
for(i in 1:n){
b = rnorm(100)
d[i] = b + trial1(input = input)[1] + trial1(input = input)[2]

In this code, the input dataframe is read repeatedly in the loop slowing down the code. Can reactivity in shiny be used so that vec1 is read off from the input only once since input is unchanging in each loop? Will making trial1 reactive do the job(and 'input' coming in as input or another reactive function/value)?