Open 5nyper opened 9 years ago
Are you accepting new languages to the benchmarks?
Yes!
I'll be happy to add the parts to add the Crystal programming language
Awesome!
I've quickly updated [1] the CLI tool that runs the benchmarks to work with the latest Rust nigthly. And I've also added "support" for the Crystal lang (see 7e0ccfe8d6f40da2440fc9ad450eb33dac5be0b8). What needs to be done right now is write the "template" program in crystal.
All the benchmark programs must adhere to this specification:
-a
, it must solve the problem and print (println!
/puts
) the answer to stdout.n
, after parsing n
, the program will solve the problem n
times and print the time (used to solve the problem n
times) in nanoseconds to stdout.The template program follows this spec, but doesn't actually solve any problem (the "solution" is just an empty function). Check the template programs in other languages.
The important bit here is that the time must be measured using a monotonic timer. I don't know if Crystal has access to one in its stdlib. If it doesn't we can use librt's clock_gettime via FFI (see Python's template).
After we write the template program, we can easily add solutions to problems by copying the template into the problems/$ID
folder and changing the solution
function. Then you just call make bench
to run the benchmarks [2].
[1] The tool is written in old Rust and panic!
s a lot. I'll probably rewrite it with better error handling and diagnostics.
[2] make bench
will run all the benchmarks (all the problem and all the languages) by default. And it will panic if a compiler/interpreter is missing (see [1]). You can "disable" other languages by removing (or changing the extension of) the corresponding json file from the languages
directory.
I'll get right on writing a template program! Also, should the compiler flag be --release
for optimizations?
@Ap0ph1s Nice
Also, should the compiler flag be --release for optimizations?
If it adds optimizations, yes. Just add the flag to this vector
(FYI, rewriting the CLI tool at the moment, will open a PR soon)
Are you accepting new languages to the benchmarks? if so, I'll be happy to add the parts to add the Crystal programming language - http://crystal-lang.org