https://github.com/byron/plusone
An experiment to experience differences between Java and Rust
https://github.com/byron/plusone
Last synced: about 1 year ago
JSON representation
An experiment to experience differences between Java and Rust
- Host: GitHub
- URL: https://github.com/byron/plusone
- Owner: Byron
- Created: 2015-09-26T10:06:16.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-26T15:11:25.000Z (over 10 years ago)
- Last Synced: 2025-02-12T14:17:18.872Z (over 1 year ago)
- Language: Java
- Size: 125 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
An experiment to see the differences when trying to solve a simple problem, *adding one to all numbers given as arguments*, with Java and Rust.
One obvious difference is the amount of code needed:
```bash
$ tokei -s code -e benches .
# curated output
--------------------------------------------------------------------------------------------------
Language Files Total Blanks Comments Code
--------------------------------------------------------------------------------------------------
Java 3 53 11 0 42
Rust 2 32 5 0 27
--------------------------------------------------------------------------------------------------
```
Another one might be that Rust clearly is less wordy, denser, and *possibly* easier to grasp.
In any case, rust is doing the work *far more efficiently*.
Simple benchmarking is easy to do in Rust, yet I was unable to get it to work using *JMH* in IntelliJ after an hour. It certainly doesn't mean much, except for showing that such a task is not too intuitive and easily done with my java toolchain.
Because of that, the Rust micro-benchmark stands without comparison.