Code Monkey home page Code Monkey logo

parallel_map's Introduction

Parallel map

Description

This is Simon Litvinskii test task.

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:

  1. Vec
  2. Function f(t: T) -> R

Threshold can be just constant.

You should return:

  1. 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

Important things

  1. 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.
  2. Benchmarks, now I didn't make any benchmarking. If I should please write me about it.
  3. Dev-dependencies - tokio is really big and the solution itself doesn't use it. To speed up build I put it in dev-dependencies.
  4. 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.

parallel_map's People

Contributors

montaglue avatar

Stargazers

Oleg Sidorenkov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.