First, we load some colorbar data and define val
for testing
Get["https://pastebin.com/raw/gN4wGqxe"] vals = N@Subdivide[200000];
then, definition
ClearAll[ParulaCM, ParulaCM2]; ParulaCM = With[{colorlist = RGBColor @@@ parulaColors}, Blend[colorlist, #] &]; ParulaCM2 = With[{colorlist = RGBColor @@@ parulaColors}, Blend[colorlist, #] &];
You may notice that ParulaCM
and ParulaCM2
is exactly the same. I do it on purpose.
Now timing it
ParulaCM /@ vals; // AbsoluteTiming ParulaCM2 /@ vals; // AbsoluteTiming
with a fresh start you may probably got this
{0.400419, Null} {1.03218, Null}
This is already odd, because ParulaCM
is the same as ParulaCM2
. However, ParulaCM2
is slower
Now you run the previous definition a second time, and time it again. This time you probably got
ParulaCM /@ vals; // AbsoluteTiming ParulaCM2 /@ vals; // AbsoluteTiming (*{1.12729, Null} {1.07233, Null}*)
Yeah, they are same again!!
Now even more peculiar, now you run this
Wow, the ParulaCM
is fast again.
I am totally lost. What kind of issue is this?