ruby-to-crystal
ruby-to-crystal
Examples of ruby code converted to crystal and benchmarks to show the speed increase with compiled crystal code.
Dependencies
Both Ruby and Crystal need to be installed on your system. If they aren't already, follow the installation guide for Ruby and the installation guide for Crystal
If you already have Ruby and you are using Mac OS X with homebrew, install Crystal using:
brew install crystal-lang
Installation & Usage
- Clone the repo
git clone git@github.com:marksiemers/ruby-to-crystal.git
# OR
git clone https://github.com/marksiemers/ruby-to-crystal.git
- Choose an example and cd into that directory
# for leap-year
cd src/leap-year
- Run the ruby example
ruby leap_year.rb
- Run the crystal example
crystal leap_year.cr
- Run the ruby benchmark
ruby leap_year_bench.rb
- Compile and run the crystal benchmark
crystal leap_year_bench.cr --release
- Pledge your undying allegiance to crystal
Development
If you want to add an example, create a folder that contains these files at a minimum:
{example}.cr
{example}.rb
{example}_bench.cr
{example}_bench.rb
Additionally, it may be helpful to provide an {example}.sh
that will execute the example in both languages and report the benchmark results.
Contributing
- Fork it ( https://github.com/marksiemers/ruby-to-crystal/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- marksiemers Mark Siemers - creator, maintainer
Repository
ruby-to-crystal
Owner
Statistic
- 10
- 0
- 0
- 0
- 0
- over 2 years ago
- November 11, 2017
License
Links
Synced at
Thu, 21 Nov 2024 16:45:10 GMT
Languages