I was a Java programer, I start to learn C programming now. I thought C is faster than Java, and the performance is much better because games are most likely written in C.
Last night I wrote a program, same methodology and algorithm, Java program gets the result under 60 seconds, and C program took 122 seconds. I am quite surprise about that huge different.
However, it could be my problem since I am new to C. The part takes significant time of the program is only one method, this method is recursively called by itself known as recursive method. And inside this method, I allocate memory to hold some data which its type is char **, it is 2D char array. Also memcpy data into this new allocated memory. And I have to free it after the recursive call. I am quite sure this takes a lot of time. In C, I do it manually. In Java, handled by garbage collection.
I just wonder if there is anyway to improve this C program performance so that it can beat the Java program. Any suggestion would be appreciated.



LinkBack URL
About LinkBacks




thx
Because Tetris Is Unrealistic.