# Memoization of functions with vector inputs in Julia and JuMP

**URL:** <https://discourse.julialang.org/t/memoization-of-functions-with-vector-inputs-in-julia-and-jump/18143>\
**Category:** Performance\
**Tags:** jump\
**Created:** [November 29, 2018, 3:30pm UTC](https://discourse.julialang.org/t/memoization-of-functions-with-vector-inputs-in-julia-and-jump/18143 "2018-11-29T15:30:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olegg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olegg/32/51316_2.png) [@Olegg](https://discourse.julialang.org/u/Olegg)\
**Post date:** [November 29, 2018, 3:30pm UTC](https://discourse.julialang.org/t/memoization-of-functions-with-vector-inputs-in-julia-and-jump/18143/1 "2018-11-29T15:30:14Z")

</div>

I’m evaluating the trade-offs and efficient use of memoization with lengthy vectors, particularly in optimisation. Suppose a vector input to an expensive function has many Float64 elements, say, 100,000. When this function is memoized:

1. Is the whole vector stored or just some ID/ hashcode?

2. Is the equality with an incoming vector tested by reference or by value? Does this depend on the number of elements?

3. How can some of the memoized keys/values be deleted programmatically (e.g., by popping a stack)?

4. How would the above apply if the input vector was the optimisation variable in JuMP?

Many thanks!
