cberner / raptorq

Rust implementation of RaptorQ (RFC6330)
Apache License 2.0
296 stars 49 forks source link

100% cpu usage #73

Closed ErQrYfkrju closed 4 years ago

ErQrYfkrju commented 4 years ago

Running example code with data over 1MB causes 100% CPU usage

cberner commented 4 years ago

100% CPU usage for how long? RaptorQ is a very CPU intensive algorithm, so that's probably expected

ErQrYfkrju commented 4 years ago

Running all examples on VM with 8GB RAM let mut data: Vec = vec![0; 64*1024];

real    0m0.088s
user    0m0.088s
sys 0m0.000s

let mut data: Vec = vec![0; 128*1024];

real    0m0.229s
user    0m0.224s
sys 0m0.004s

let mut data: Vec = vec![0; 256*1024];

real    0m1.000s
user    0m0.995s
sys 0m0.004s

let mut data: Vec = vec![0; 512*1024];

real    0m11.653s
user    0m11.626s
sys 0m0.021s

let mut data: Vec = vec![0; 768*1024];

real    0m34.859s
user    0m34.748s
sys 0m0.085s

let mut data: Vec = vec![0; 1024*1024];

real    1m17.843s
user    1m17.785s
sys 0m0.036s
cberner commented 4 years ago

Did you build in release mode? It should be much faster than that. For 1MB I get the following:

time target/release/examples/main

real    0m0.054s
user    0m0.042s
sys 0m0.013s

The debug build is much slower, but that's expected:

time target/debug/examples/main

real    1m59.825s
user    1m59.148s
sys 0m0.236s
ErQrYfkrju commented 4 years ago

Thanks a lot, rebuilt with --release and all runs pretty fast. While in --debug mode I got 1,5Mb/s in --release I got nearly 87MB/s while sending file with 256K chunks, and 95.7MB/s with 128K chunks.