Nim icon indicating copy to clipboard operation
Nim copied to clipboard

Add envvars.getEnv

Open juancarlospaco opened this issue 3 years ago • 5 comments

  • Added envvars.getEnv overload that stores the value in argument.

juancarlospaco avatar May 06 '22 22:05 juancarlospaco

What exactly is the point of this? What's wrong with value = getEnv(...)?

konsumlamm avatar Aug 04 '22 15:08 konsumlamm

Stores the value in argument, not creating a new string, code is tiny, I do not know how to make the explanation more explicit.

juancarlospaco avatar Aug 04 '22 21:08 juancarlospaco

Hm, I'm not sure about this. Isn't the compiler supposed to optimize this (through use of move analysis, etc.)?

Varriount avatar Aug 05 '22 19:08 Varriount

the compiler supposed to optimize this

Prove me wrong plz, but it looks like a new string is created on my machine, AFAIK.

juancarlospaco avatar Aug 05 '22 22:08 juancarlospaco

Do you actually have a program which calls getenv in a hot code path and so sees significant improvements in performance thanks to this new proc? If so, what are the improvements?

dom96 avatar Aug 05 '22 23:08 dom96