Skip to content

Explore adding Crystal #139

@leon0399

Description

@leon0399

Why Crystal

Crystal has Ruby-like syntax but compiles to native code via LLVM. Since Ruby is already in the benchmark suite (with CRuby, JIT, and JRuby variants), Crystal would provide a direct and likely dramatic comparison — same familiar syntax, radically different runtime characteristics.

Key considerations

  • Compiles to native code via LLVM — expect performance closer to Go/Rust than Ruby
  • Ruby-inspired syntax — implementations can closely mirror existing Ruby code
  • Static typing with type inference (no type annotations needed in most cases)
  • crystal build --release for optimized builds
  • Null safety built into the type system — may require minor adaptations for treap

Implementation

Implement all 7 benchmark algorithms following the reference implementations (PHP, C++, Python):

  • collatz/MaxSequence
  • linpack/Linpack
  • mandelbrot/Simple
  • primes/Atkin
  • primes/Simple
  • recursion/Tak
  • treap/Naive

Setup:

  • Create langs/crystal/benchmark.yml
  • Create docker/crystal/Dockerfile
  • Update README.md implementation table

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions