Marius: I think you'd be better off in learning to write fast Julia code if
you presented an straightforward implementation of a classic PDE problem
and asked for help in optimizing that. Maybe 2D heat equation would be a
good place to start. The code you've presented is not really intelligible
I don't know anything about plasma physics, but this entire code is in
global scope and uses a bunch of non-const global arrays. This is the very
first thing the performance tips warn against:
http://julia.readthedocs.org/en/latest/manual/performance-tips/
Refactor your code into functions that
In my experience it is helpful to have a Fortran version to compare speeds
against when learning Julia.
This would be easy w.r.t. your problem.
It is easy to right functional Julia code that is very slow, but looks
okay. The best way for me was to have
have a basis of comparison.
On Monday,
Ok...wow...I am not surprised it is slow. Well here is what you could try.
1. Wrap everything into a function. Julia has difficulty with globals.
2. You are defining pointless functions in a loop. You can easily change
the code to exclude them
3. In your loops you are accessing arrays in row