Live data from Hacker News

Futures for C++11 at Facebook

code.facebook.com

1–10 of 84 posts

Re: Futures for C++11 at Facebook

#2
I'm totally on board with futures, IF your application needs to scale to the point that blocking, threaded computation is infeasible. However, I honestly don't think that's the case for most folk. Blocking, direct-call computation is way simpler than futures.

Re: Futures for C++11 at Facebook

#7
post #3

Futures sounds a lot like Promises to me. Or am I wrong?

Futures can be created with promises:

- http://en.cppreference.com/w/cpp/thread/future

- http://en.cppreference.com/w/cpp/thread/promise

- https://en.wikipedia.org/wiki/Futures_and_promises

- http://docs.scala-lang.org/overviews/core/futures.html

Re: Futures for C++11 at Facebook

#8
I'd be interested in seeing why instagram didn't implement the suggested user service as a batch process that populated some KV store. Online evaluation is great for guaranteeing up-to-date results, but the tradeoff is that you now have to bring up and maintain a fairly critical production service.

> The SU service fetches candidate accounts from various sources, such as your friends, accounts that you may be interested in, and popular accounts in your area. Then, a machine learning model blends them to produce a list of personalized account suggestions.

> This enabled us to reduce the number of instances of the Suggested Users service from 720 to 38.

Re: Futures for C++11 at Facebook

#9
post #6

Can someone explain to me what does it add over http://www.boost.org/doc/libs/1_58_0/doc/html/thread/synchro... and pros/cons ? Thanks.

It is along the same lines as boost's futures implementation. We have a different mechanism for expressing thread management, born out of trial and error and Facebook engineer feedback. At the time we set out to write this boost futures were slow and buggy (1.53), and C++ standard monadic futures proposals were in very early stages (it now appears that there will be monadic futures in C++17). I do not know if boost futures are now more robust and/or more performant in 1.58.

Re: Futures for C++11 at Facebook

#10
Rats, the terminology is backwards from the E/JavaScript promise/future distinction: https://en.wikipedia.org/wiki/Futures_and_promises#Read-only...

There's been a push to standardize "Promise" to be the read-only side and "Future" to mean the resolver/promise pair, but Folly Futures use the opposite convention.

Agreeing on terminology is hard. :)

Edit: I think it's fine that Folly adopted the C++11 convention. I'm just whining in the open that that promise vs. future may never be agreed upon.

Post reply on HN