ordo-one / package-benchmark

Swift benchmark runner with many performance metrics and great CI support
Apache License 2.0
326 stars 25 forks source link

Support for memcpy metrics #241

Closed jcavar closed 7 months ago

jcavar commented 7 months ago

Hello,

Thank you for this great package!

I was wondering if it would be possible to provide a hook and metric for memcpy?

hassila commented 7 months ago

Probably would want to capture the number of loads/stores rather in that case so the actual mechanism used for the copying doesn't matter - or is there some specific reason why you'd want to capture just memcpy exactly?

Would need some research and look at how the data can be captured (e g. Look at perf on Linux, and something similar on macOS) - happy to consider a PR for that if you find some way to capture it without requiring privilege escalation.

What is the reason you want to measure this?

jcavar commented 7 months ago

Probably would want to capture the number of loads/stores rather in that case so the actual mechanism used for the copying doesn't matter - or is there some specific reason why you'd want to capture just memcpy exactly?

I was doing some experiments and benchmarks around the performance impact of borrowing and consuming modifiers here. It was great to see a number of retain/release operations for particular benchamark, so I missed something similar for value types.

But I see your point, I think I was too quick to assume that these translate to memcpy.

Would need some research and look at how the data can be captured (e g. Look at perf on Linux, and something similar on macOS) - happy to consider a PR for that if you find some way to capture it without requiring privilege escalation.

Got it, at some point I would like to look into it. As well as some other potential features (e.g. swift_beginAccess and swift_endAccess)

hassila commented 7 months ago

That would be great, also begin/end access would be super to capture!

hassila commented 7 months ago

And very nice blog post by the way! 👍🏻🎉

jcavar commented 7 months ago

Thank you! Will close this task since there is no immediate action.