add readme
This commit is contained in:
parent
657e470d24
commit
1f4d8b5ce3
38
README.md
Normal file
38
README.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Rust vs Go
|
||||||
|
|
||||||
|
This repository contains two quick implementations of echo servers in both [Rust] and [Go]. Both are
|
||||||
|
great languages with lots of support, I wanted to take a look at the type of operations that our programs
|
||||||
|
will be performing to get an idea of how well each will perform.
|
||||||
|
|
||||||
|
## Running the Rust server
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd rust
|
||||||
|
cargo run src/main.rs
|
||||||
|
# Listening on http://127.0.0.1:3000
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running the Go server
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd go
|
||||||
|
go run main.go
|
||||||
|
# Listening on 127.0.0.1:3001
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing the servers
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 2MiB
|
||||||
|
RAND_CHARS=$(( 2 * 1024 * 1024 ))
|
||||||
|
|
||||||
|
# send requests to Rust
|
||||||
|
time bash -c 'tr -dc A-Za-z0-9 </dev/urandom | head -c $RAND_CHARS | curl -X POST -d@- http://localhost:3000'
|
||||||
|
# ... bash -c 0.04s user 0.05s system 7% cpu 1.114 total
|
||||||
|
|
||||||
|
# send requests to Go
|
||||||
|
time bash -c 'tr -dc A-Za-z0-9 </dev/urandom | head -c $RAND_CHARS | curl -X POST -d@- http://localhost:3001'
|
||||||
|
# ... bash -c 0.04s user 0.05s system 84% cpu 0.114 total
|
||||||
|
```
|
||||||
|
|
||||||
|
Rust has a noticably longer echo time when compared to Go.
|
Loading…
x
Reference in New Issue
Block a user