Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

musical /prog/ challange

Name: Anonymous 2010-09-22 14:03

Create an ordered list of fractions which product of the numerator and denominator equals a specific integer n.

ex: n=60
1/60, 2/30, 3/20, 4/15, 5/12, etc....

then do it with a list of integers.

If you are fancy you can also create a scale from the fractions you've got which best matches western tempered tuning (or any you prefer).

Name: Anonymous 2010-09-23 2:03

>>20
First off, all you did was omit frame pointers. You specified no optimizations. Secondly, Java performs a lot of those optimizations without any specifications.

Thirdly, it's possible that Java optimizes the int j initialization to outside of the loop, whereas C/C++ will not do this for you. There's some time wasted in allocating/destroying j for every iteration of i. The other two are far more pressing issues for comparison, though.

You're basically testing unoptimized compilation versus unoptimized execution, it's obvious which should be the victor.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List