Latest 0.1.0
Homepage https://github.com/kastiglione/ConcurrentCollectionOperations
License MIT
Authors , ,

Concurrent Collection Operations

A set of categories for performing concurrent map and filter operations on
Foundation data structures. NSArray, NSDictionary, NSSet, NSOrderedSet,
and NSMapTable (OS X) are currently supported.

Concurrency is achieved using Grand Central Dispatch’s dispatch_apply. By
default, operations are run on the default priority global concurrent queue
(DISPATCH_QUEUE_PRIORITY_DEFAULT). The operations can be performed on any
concurrent queue, see the category header files.

Please note that using this code could actually result in slower performance.
For example, if a map or filter operation uses up a large amount of memory,
then performing it concurrently could cause memory thrashing. Currently, this
API does not offer a way to limit the amount of concurrency, but doing so
explicitly with dispatch_semaphore is straight forward.

This library is based off code and ideas from @alloy
and @seanlilmateus.

Installation

Install via CocoaPods, or by adding the Xcode project
to your project.

Examples

These examples are taken from the tests.

Doubling the values of an array:

NSArray *doubled = [numbersArray cco_concurrentMap:^(NSNumber *number) {
    return @(2 * number.unsignedIntegerValue);
}];

Filtering even numbers out of a dictionary:

NSDictionary *filtered = [numbersDictionary cco_concurrentFilter:^BOOL (NSNumber *number) {
    return number.unsignedIntegerValue % 2 == 1;
}];

Contributors

ConcurrentCollectionOperations has been made by @alloy,
@CodaFi, @jballanc,
@kastiglione, and
@seanlilmateus.

TODO

  1. Write heavier/stressing tests.

License

Concurrent Collection Operations is released under the MIT License. See
LICENSE.txt.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am ‘Add some feature’)
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Latest podspec

{
    "name": "ConcurrentCollectionOperations",
    "version": "0.1.0",
    "summary": "Concurrent map and filter on NSArray, NSDictionary, NSSet using GCD.",
    "description": "    This is a set of categories for performing concurrent map and filtern    operations on Foundation data structures, currently NSArray, NSDictionary,n    NSSet.nn    Concurrency is achieved using Grand Central Dispatch's (GCD) dispatch_apply.n    By default, operations are run on the default priority global concurrentn    queue. The operations can be performed on any concurrent queue. This libraryn    provides similar functionality to `pmap` as found in other languages.n",
    "homepage": "https://github.com/kastiglione/ConcurrentCollectionOperations",
    "license": "MIT",
    "authors": {
        "Dave Lee": "[email protected]",
        "Eloy Duru00e1n": "[email protected]",
        "Mateus Armando": "[email protected]"
    },
    "source": {
        "git": "https://github.com/kastiglione/ConcurrentCollectionOperations.git",
        "tag": "v0.1.0"
    },
    "source_files": "ConcurrentCollectionOperations",
    "requires_arc": false
}

Pin It on Pinterest

Share This