Looking for variant approach/sketch

  • Interesting, when we use the code below, the scope measures 186ns. to get the answer. i.e facValue = factorialR(7); //5040
    When the code is written so optimization doesn't happen we get 32.9us.
    .
    So yes the compiler is sticking their grimy little fingers into the pie :smiling_face_with_sunglasses:

optimized 186ns verses not optimized 32.9us

facValue = factorialR(7);

optimized 61.8us verses not optimized 59.7us

facValue = factorialR(12);





optimized 186ns verses not optimized 28.6us

facValue = factorialI(7);


optimized 56.2us verses not optimized 56us

facValue = factorialI(12);