mirage-crypto icon indicating copy to clipboard operation
mirage-crypto copied to clipboard

[optim - C binding] Use a contiguous array/flat representation for coordinates

Open dannywillems opened this issue 1 year ago • 2 comments

At the moment, in the C bindings, the points are represented as a struct with 3 fields. It creates 3 indirections when calling the C code. When performing many operations on the same point, the same memory page, containing the 3 coordinates, can stay in the CPU cache, which may give a possible non-negligeable performance improvement.

dannywillems avatar Jul 14 '24 10:07 dannywillems

This is about the elliptic curves (mirage-crypto-ec). This is a good idea, would you mind to submit a PR and have some performance numbers before&after (see bench/speed.exe)?

hannesm avatar Jul 15 '24 10:07 hannesm

This is about the elliptic curves (mirage-crypto-ec). This is a good idea, would you mind to submit a PR and have some performance numbers before&after (see bench/speed.exe)?

I can not commit to anything for the next two weeks. Maybe beginning of August I will have some spare time. More generally, I was curious about checking more the C related code to see if a flat representation in a single custom block can be used. A flat structure of a multiple of 64 bits can be used in general.

dannywillems avatar Jul 17 '24 12:07 dannywillems