Sunday 15 August 2010

performance - Julia much slower than Java -


I'm new to Julia and I have written a simple task that calculates RMSE (Root Earth Square Error) . There is a matrix of Ratings ratings, each line is [user, movie, rating] . The 15 million rating is rmse () The method takes 12.0 s, but the Java implementation is approximately 188x faster: 0.064 s Why is Julia implementation slow? In Java, I am working with an array of the rating object, if it was a multidimensional int array, it would be faster. Returns (User, Film) Returns 3.462 and Function RMSE (Total) = 0.0 I in 1: Size (ratings, 1) R =

  Ratings = Reddel M ("Ratings Data", Int 32) Rating [i,:] Diff = predict (r [1], r [2]) - r [3] Total + = diff * Difference end return sqrt (Total / Size (rating) [1]) End   

EDIT: After avoiding global variables, it is over in the 1990s (31x slower than Java). r = Rating [i ,:] After removing it, it is 0.856 s (13x slow).

Some suggestions:

  • Do not use global annoyance for technical reasons Instead, they are slow, instead, pass rating as an argument.
  • r = Rating [i ,:] creates a copy that is slow, instead of predict (r [i, 1], r [i, 2]) - r [i, 3] .
  • Can be faster than class () x * x .
  • If you are using the blood-bearing edge of Julia, then see the brand new, which is highly customized for many common numerical tasks ()
  • Julia The code is compiled for the first time, when it executes it. In Julia, it is time to do so many times on time and ignore it for the first time in the correct manner of the benchmark.

No comments:

Post a Comment