#profiling? how?

1 messages · Page 1 of 1 (latest)

alpine coral
#

So I've spent the last 3 weeks porting a particular app to zig. It actually works! Now I need to make it faster. How do I do this? What profile tool(s) are people using? Keep in mind I'm a newbie to zig.

quiet snow
alpine coral
#

I am indeed on macos I'll give that a try

#

oof I don't have xcode installed

#

19gb later... 😛

#

are there any guides out there for profiling?

quiet snow
#

With Xcode? start the executable and attached Instrument to it, it's pretty straightforward. Any guide on profiling using xcode (not necessarily Zig) will probably be useful.

alpine coral
#

so basically just make sure I build in debug mode and use that bin?

#

are there any lighter alternatives to xcode on mac? I'll setup xcode if I have to, was just wondering if there's something less...crazy....

alpine coral
#

I'm running xcode now. In the cpu profiler, what are mc and gc units?

quiet snow
#

pretty sure it's cycles. Megacycles, gigacycles... You essentially want to drill down the largest %, double click to see the code...see where most of the samples are from...and then drill down into that and so on

alpine coral
#

ahh ok

#

I've already found a couple easy wins

#

std.math.pow(n, 2) is significantly slower than n * n

#

I've got to be doing something highly unoptimal still

#

because my javascript implementation takes about 23s, and zig takes about 14s

#

definitely an improvement but I would have expected zig to just absolutely destroy js in this highly cpu bound problem

#

I'm assuming zig run -O ReleaseFast src/main.zig will rebuild my bin in releasefast mode, even if I've already built it in debug mode?

quiet snow
#

Ya.

alpine coral
#

does the 0.11 build boast any big perf gains over 0.10? I'm still on 0.10