Saturday

Measure execution time with Julia, example using sorting algorithms

# random integers between 1 and 100 inclusive, generate thousands of them

x = rand(1:100, 100000)


@time sort(x; alg=InsertionSort, rev=false)

# 1.091568 seconds (35.79 k allocations: 1.899 MiB, 2.55% compilation time)


@time sort(x; alg=QuickSort, rev=false)

# 0.099377 seconds (107.61 k allocations: 5.397 MiB, 98.81% compilation time)

No comments:

Fire survival tips

1 Stop, drop, cover and roll  If your clothes catch fire stop, drop, cover your face with your hands and roll to smother the flames. 2 Get d...