I’m working with arrays of the following type `Vector{Vector{Tuple{Int32,Float32}}}`

to represent an adjacency matrix. These are stored in some struct

```
mutable struct SomeStruct
...
adj::Vector{Vector{Tuple{Int32,Float32}}}
...
end
SomeStruct(len,wid) = SomeStruct(..., fillAdjList(len,wid),...)
function fillAdjList(len,wid)::Vector{Vector{Tuple{Int32,Float32}}}
adj = Vector{Vector{Tuple{Int32,Float32}}}(undef, len*wid)
#some algo to fill the and list sorted by the Int32
return adj
end
```

The adjacency matrix is used later in my program to calculate some energy function for a given vertex in a graph. The way it is used is it gets accessed and then some loop iterates over the tuples, accessing some other array based on the Int32 in first part of the tuple, and multiplying by the Float32 in it.

I was working on updating the algorithm to create the adjacency matrix in a more efficient way, and noticed somewhere down the line my program was running slower than it used to be. I found out it is the adjacency matrix, although entry by entry it’s exactly the same after changing the algorithm. I tried adding proper type annotations everywhere, but to no avail.

What I found works is when changing the initialization of SomeStruct with a deepcopy of the adjacency matrix,

```
SomeStruct(len,wid) = SomeStruct(..., deepcopy(fillAdjList(len,wid)),...)
```

which returns the algorithm to its original speed. I’m a bit stumped on what could cause this performance difference. I was thinking it must be either some kind of type instability or data locality problem, but I don’t really know how to find out.