Giter Club home page Giter Club logo

parallel's Introduction

Parallel

A library that implements Elixir's Enum interface but parallelized.

:timer.tc fn -> Enum.map 1..10, fn i -> :timer.sleep(1000) end end
# -> {10010674, [:ok, :ok, :ok, :ok, :ok, :ok, :ok, :ok, :ok, :ok]}
# Run time is 10 seconds
:timer.tc fn -> Parallel.map 1..10, fn i -> :timer.sleep(1000) end, size: 10 end
# -> {1001653, [:ok, :ok, :ok, :ok, :ok, :ok, :ok, :ok, :ok, :ok]}
# Run time is 1 second

TODO

  • Implement all Enum functions
    • all?(collection, fun \\ fn x -> x end)
    • any?(collection, fun \\ fn x -> x end)
    • at(collection, n, default \\ nil)
    • chunk(collection, n)
    • chunk(collection, n, step, pad \\ nil)
    • chunk_by(collection, fun)
    • concat(enumerables)
    • concat(left, right)
    • count(collection)
    • count(collection, fun)
    • dedup(collection)
    • dedup_by(collection, fun)
    • drop(collection, count)
    • drop_while(collection, fun)
    • each(collection, fun)
    • empty?(collection)
    • fetch(collection, n)
    • fetch!(collection, n)
    • filter(collection, fun)
    • filter_map(collection, filter, mapper)
    • find(collection, default \\ nil, fun)
    • find_index(collection, fun)
    • find_value(collection, default \\ nil, fun)
    • flat_map(collection, fun)
    • flat_map_reduce(collection, acc, fun)
    • group_by(collection, dict \\ %{}, fun)
    • intersperse(collection, element)
    • into(collection, list)
    • into(collection, list, transform)
    • join(collection, joiner \\ "")
    • map(collection, fun)
    • map_join(collection, joiner \\ "", mapper)
    • map_reduce(collection, acc, fun)
    • max(collection)
    • max_by(collection, fun)
    • member?(collection, value)
    • min(collection)
    • min_by(collection, fun)
    • min_max(collection)
    • min_max_by(collection, fun)
    • partition(collection, fun)
    • random(collection)
    • reduce(collection, fun)
    • reduce(collection, acc, fun)
    • reduce_while(collection, acc, fun)
    • reject(collection, fun)
    • reverse(collection)
    • reverse(collection, tail)
    • reverse_slice(collection, start, count)
    • scan(enum, fun)
    • scan(enum, acc, fun)
    • shuffle(collection)
    • slice(collection, range)
    • slice(collection, start, count)
    • sort(collection)
    • sort(collection, fun)
    • sort_by(collection, mapper, sorter \\ &<=/2)
    • split(collection, count)
    • split_while(collection, fun)
    • sum(collection)
    • take(collection, count)
    • take_every(collection, nth)
    • take_random(collection, count)
    • take_while(collection, fun)
    • to_list(collection)
    • uniq(collection)
    • uniq_by(collection, fun)
    • unzip(collection)
    • with_index(collection)
    • zip(collection1, collection2)
  • Short circuit relevant functions (any?/2, find/3 etc.)
  • Investigate Stream compatibility (option stream: true?)
  • Decide on implementing all functions or just relevant ones (e.g. first/1)
  • Add documentation
  • Add link: false option
  • Add sorted: true option

parallel's People

Contributors

eproxus avatar

Watchers

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