Improving an algorithm that compute gps distances

@Vasily_Pisarev You should use np.asarray as the end since np.array forces a copy of the data. I made these changes and got this numbers using 8 cores:

distances  1.744 s (40 allocations: 286.18 MiB)
distances_bcast  1.464 s (30 allocations: 95.44 MiB)
distances_threaded  330.340 ms (105 allocations: 190.82 MiB)
distances_threaded_simd  150.763 ms (104 allocations: 190.82 MiB)
dist_np_test  1.413 s (39 allocations: 95.37 MiB)
dist_jax_test 259.303 ms (8 allocations: 320 bytes)

code: final.jl · GitHub

Wow! Julia + SIMD is amazing. I am guessing Jax doesn’t use SIMD. As noted on Twitter the allocation numbers for Jax don’t mean anything.

Thanks all! I’ve learned a lot today :smiley:

7 Likes