Does Julia's speed get slower over time in REPL?

When I’m on a Julia REPL that has been running for a while, I find that julia will slow down, but if I restart the REPL, the speed returns to normal.

For example, I have a function denoted f(x), that takes 15 minutes in REPL, then I execute other un-related functions like g(x), z(x)… , then a few hours pass and I execute f(x) again and it will actually take about 28 minutes, I restart a new REPL and execute the same function and this time it will only take 15 minutes again. ( The above times are after compilation).

I have enough RAM and no other tasks on my computer, I checked the CPU rate and found that when my function run on the “fresh” REPL, the CPU% could up to 80%, and run on a REPL that has been running for a few hours, it will only take 50-60% CPU.

Sorry for no actually code for demo, I don’t know if this is a common or plausible phenomenon, or if it’s just something very specific in my case. Have you ever been in a similar situation?

This is very unusual. My best guess is that it’s memory/GC related, but it’s hard to know.

I often leave my Julia REPLs running for days on end at times – I do not see this sort of behavior. Would you be willing to share about the following?

Operating System:
Julia Version:
Packages you use in your global environment:
Terminal emulator:
Any snippets of code you notice this on:

Curious if it is a regression or something specific to your set-up (my suspicion the latter). Thanks, sorry this is happening, and have a great day!

~ tcp :deciduous_tree:

1 Like

Thank you very much for the tip, I now know that my question is a very special case.

My system information

Julia v1.7
macOS 12.1
run julia in iTerm+tmux

Package:

Clustering v0.14.3
Flux v0.13.6
GraphNeuralNetworks v0.4.5
TensorBoardLogger v0.1.12

There is no special setup in my julia environment. I only notice this behavior when I train neural network model with Flux. I’ll pay a little more attention to memory allocation next time.

Thank you again & have a great day!

As an additional note, I found the answer in this post. Maybe it is related to a memory allocation/leak in Flux.