I did a test to read a SO with ctypes in Python, which is compiled with Rust. I wanted to write a function in both languages and measure their timing. These functions will calculate the b power of a. Pseudocode for algorithm is as below:
fn power(int a, int b) -> int {
int c = a
for b times {
c = c*a;
}
return c;
}
rustc power.rs --crate-type dylib
- An old computer
- Python 3.5.2
- rustc 1.7.0