Speed comparison 'if' vs ' object referencing'

I came up with a way to reduce the amount of if's/checks. It works by constructing sth like a list, with every node storing a number. The first node is of a different class than the other nodes. Now when I call the n'th node to calculate factorial it only does this: return value * pre.factorial(); Since the first node is of a different class it only does this: return 1; The thing is it's not faster than the regular recursive factorial... https://code.sololearn.com/cdHL0h171eCZ/?ref=app

8/24/2019 2:34:14 PM

Anton Böhler

3 Answers

New Answer


I think you assigning more values to memory in object recursion. So it takes more time...🤔


ran out of question space... so my question is: why is it equally fast or even slower?? 😅


does anyone have any guesses? 😅