This is Simon Litvinskii test task.
Implement basic function to split some generic computational work between threads. Split should occur only on some threshold - if computational work (input length) is shorter than this threshold, no splitting should occur and no threads should be created.
You get as input:
- Vec
- Function f(t: T) -> R
Threshold can be just constant.
You should return:
- Up to you, but probably some Vec of the same length as input(1)
Code should be published on github.
There should be some tests in repository
- Output type must be Clone, I found out the solution without this bound, but it shares data between threads, and synchronization cost would be too big.
- Benchmarks, now I didn't make any benchmarking. If I should please write me about it.
- Dev-dependencies - tokio is really big and the solution itself doesn't use it. To speed up build I put it in dev-dependencies.
- Using map in map_chunk. I prefer don't use it because it takes a function, not a reference. That makes me bound F also a Clone trait, but I don't want that.