Programs
The C++ programs ported are the non-iteractive programs from the LLVM Test Suite Shootout C++ which originates in the Programming Language Shootout:
- ackermann
- ary
- ary2
- ary3
- fibo
- hash
- hash2
- heapsort
- lists
- lists1
- matrix
- methcall
- moments
- nestedloop
- objinst
- random
- sieve
- strcat
The current criteria for programs I picked are:
- they are small
- they produce some output so that the correctness of porting can be checked
- they are deterministic and can be run without any interactive user input from a beginning to an end
- their execution times indicate their run time performance
I'd like to add more programs in the future.
Porting notes
When porting from C++ to Rust, I stick with the idiomatic style,
including the use of the standard library types, as much as
appropriate. For example, I'd use Rust's String
type where C++
std::string
(or a C char*
string) is used. Similarly, I'd use
Rust's Vec
type in place for C++ std::vector
and C/C++ raw array
types.
I wrote down porting notes for each program.
Benchmark results and performance analysis
I included benchmark results between the C++ and the Rust versions. I also included performance analysis based on the generated code for the programs whose benchmark results were significantly different,