I have a question that I think it is a stupid question maybe. So if we have an algorithm, assume it recursion algorithm, but we implement it with different programming languages, is there any performance difference between implementations? For example are from these sample code.
void printFunInCpp(int test)
{
if (test < 1)
return;
else
{
cout << test << " ";
printFun(test-1); // statement 2
cout << test << " ";
return;
}
}
static void printFunInJava(int test)
{
if (test < 1)
return;
else
{
System.out.printf("%d ",test);
printFun(test-1); // statement 2
System.out.printf("%d ",test);
return;
}
}
def printFunInPython(test):
if (test < 1):
return
else:
print( test,end = " ")
printFun(test-1) # statement 2
print( test,end = " ")
return
So, from example above, is there any performance difference within the 3 programming languages? If there is a performance difference, is there any technique to know it? How about memory usage?
Thanks