ConcurrentCollectionOperations 0.1.0

ConcurrentCollectionOperations 0.1.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.



  • By
  • Dave Lee, Eloy Durán and Mateus Armando

Concurrent Collection Operations

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

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.

This library is based off code and ideas from @alloy and @seanlilmateus. It has been created because we were unaware of an existing implementation.

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;
    }];

TODO

  1. Add benchmark target.
  2. 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