(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#ifndef H_UNORDERED_MAP_ | |
#define H_UNORDERED_MAP_ | |
#import <tr1/unordered_map> | |
template<class K, class T> | |
class HUnorderedMap { | |
public: | |
typedef typename std::tr1::unordered_map<K, T > Map; | |
typedef typename Map::value_type ValueType; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Persistent queues are really useful. I have envied Android developers for having the Tape queue http://square.github.io/tape/ and the Android Priority Jobqueue https://github.com/yigit/android-priority-jobqueue
Below I have compiled a list of the persistent queue implementations for iOS that I know of. Most of them are not in active development. Ping me if you want a library added to the list.
// | |
// SpinlockTestTests.swift | |
// SpinlockTestTests | |
// | |
// Created by Peter Steinberger on 04/10/2016. | |
// Copyright © 2016 PSPDFKit GmbH. All rights reserved. | |
// | |
import XCTest |
CGFloat BNRTimeBlock (void (^block)(void)); |
#include <stdatomic.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
/*! | |
An atomic ARC reference. Here's how it works: | |
The lowest bit of the pointer (mask 0x1) is used as a tag for the pointer being stored. | |
if the tag bit is set, that means that one thread currently owns this pointer, and will release it if the value has | |
been concurrently updated. |
The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).
My take-aways are:
You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.
Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse