How can I optimize recurrent networks in Flux?

I posted a question in stackoverflow ( regarding the performance of Flux in using a recurrent neural network. I have been getting very slow computation results compared to similar code in Mathematica and think there is probably a lot I can do to optimize the timing, but I’m really not sure where to start. Any tips?

Here is the code:

net = Chain(LSTM(8,100), Dense(100,1))

function mapNetworkOverStocks(net, stocksInput)
unFlattened = map(x -> (output = net.(x); Flux.reset!(net); output), stocksInput)
map(x -> map(y -> y[1], x), unFlattened)

mapNetworkOverStocks(net, allStocksData)

The actual data (stock data) looks like the following: