Measuring Performance & Optimisation (HPC in Julia 3/10)
ฝัง
- เผยแพร่เมื่อ 10 ก.พ. 2025
- MPAGS: High Performance Computing in Julia
This lecture covers the basics of measuring the performance of your code via benchmarking and profiling. We also cover some basic optimisation techniques by reducing heap allocations and using cache friendly implementations.
This is module designed for the Midlands Physics Alliance Graduate School (MPAGS). More information can be found on the website.
function insertintosorted!(numbers, num)
n = length(numbers)
startpoint = 1
endpoint = n + 1
while endpoint - startpoint > 1
midpoint = (startpoint+endpoint)÷2
if num < numbers[midpoint]
endpoint = midpoint
elseif num >= numbers[midpoint]
startpoint = midpoint
else
insert!(numbers, midpoint, num)
return
end
end
insert!(numbers, endpoint, num)
nothing
end