Setting `nthreads()` using the .julia/config/startup.jl file

I’m not sure what exactly you are asking here.

  1. It’s different because it’s julia code and it can never ever do anything that you cannot do in julia code, this include setting an environment variable to be used before julia starts.
  2. The number of thread is fixed on startup, it cannot be changed once julia, as in the runtime, starts running.
  3. The startup.jl is not meant to be able to do everything and is not meant to run before startup.
  4. This is documented (See the note).

Perhaps there should be a warning for setting JULIA_NUM_THREADS during a session?
I made a suggested PR. There may be a more efficient way to do it Warn if setting env variable is ineffective during a julia session by IanButterworth · Pull Request #34970 · JuliaLang/julia · GitHub

Adding a warning without a way to disable it is almost always a bad idea.