1. 03 Mar, 2015 11 commits
    • Jim Meyering's avatar
      folly: OptionalTest.cpp: suppress a -Wself-move warning · cb2d6c84
      Jim Meyering authored
      Summary:
      Clang's new -Wself-move warning dings this code:
      
      b = std::move(b);
      
      But in this case, that is a deliberate test of
      this capability, so we suppress that particular
      warning for the duration of this small test function.
      
      Test Plan:
      Run this and note that it now compiles: (it passes the tests, too)
      fbconfig --clang --with-project-version=clang:dev -r folly/test:optional_test && fbmake dbgo
      
      Reviewed By: watashi@fb.com
      
      Subscribers: folly-diffs@, yfeldblum
      
      FB internal diff: D1849689
      
      Tasks: 6244745
      
      Signature: t1:1849689:1423877932:4f479d682bd8ba97dcabed7fc29ce0a22c013969
      
      @build-break (using this to work around bogus push failure: https://phabricator.fb.com/P19730606)
      cb2d6c84
    • Jim Meyering's avatar
      folly/ExceptionWrapper.h: avoid warning about typeid operand side effects · a3259f63
      Jim Meyering authored
      Summary:
      * folly/ExceptionWrapper.h (class_name): Clang is not yet smart enough to
      see that there is no harm in dereferencing an "item_" that we've just
      verified is non-NULL.  Accommodate it, to avoid this:
      ./folly/ExceptionWrapper.h:199:30: error: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Werror,-Wpotentially-evaluated-expression]
      return demangle(typeid(*item_));
      ^
      
      Test Plan:
      Run these commands and note there are fewer errors than before:
      fbconfig --clang --with-project-version=clang:dev -r folly && fbmake dbgo
      
      Reviewed By: mhorowitz@fb.com
      
      Subscribers: trunkagent, yfeldblum, folly-diffs@
      
      FB internal diff: D1848327
      
      Tasks: 6244745
      
      Signature: t1:1848327:1423869597:a58c9e9e3671befb78ae07fbd274a13d08ffb2a7
      
      Blame Revision:
      a3259f63
    • Yedidya Feldblum's avatar
      clang:dev rejects vector<atomic<T>> in EventBaseTest.cpp. · bb4612a0
      Yedidya Feldblum authored
      Summary: [Folly] clang:dev rejects vector<atomic<T>> in EventBaseTest.cpp.
      
      Test Plan: Build and run `folly/io/async/test/EventBaseTest.cpp` using the current `clang`; try building with `clang:dev` and verifying that at least the related failures are gone.
      
      Reviewed By: meyering@fb.com
      
      Subscribers: mathieubaudet, folly-diffs@, yfeldblum, dougw, brettp
      
      FB internal diff: D1848749
      
      Tasks: 6244720
      
      Signature: t1:1848749:1423866420:7b7354d4568b6a6d6a824236ae8d271f6855d90b
      bb4612a0
    • Jim Meyering's avatar
      folly: move side effects out of EXPECT_EQ args · 0234d5d1
      Jim Meyering authored
      Summary:
      This avoids warnings about e.g., sizeof(k++) that result
      from macro expansion.
      * folly/futures/test/ExecutorTest.cpp: Move increment out
      of macro argument list.
      * folly/test/FBVectorTestBenchmarks.cpp.h: Likewise.
      * folly/test/LazyTest.cpp: Likewise.
      Otherwise, we'd get errors like this:
      
      folly/test/LazyTest.cpp:49:118: error: expression with side effects has no effect in an unevaluated context [-Werror,-Wunevaluated-expression]
      switch (0) case 0: default: if (const ::testing::AssertionResult gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(++globalCount())) == 1)>::Compare("++globalCount()", "1", ++globalCount(), 1))) ; else ::testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "folly/test/LazyTest.cpp", 49, gtest_ar.failure_message()) = ::testing::Message();
      ^
      
      Test Plan:
      Run these commands and note there are fewer errors than before:
      fbconfig --clang --with-project-version=clang:dev -r folly && fbmake dbgo
      
      Reviewed By: njormrod@fb.com
      
      Subscribers: folly-diffs@, jsedgwick, yfeldblum
      
      FB internal diff: D1848324
      
      Tasks: 6244745
      
      Signature: t1:1848324:1423860890:bce44c5e0895804a21957893ae6b78e76dfbc4d3
      0234d5d1
    • Jim Meyering's avatar
      folly: avoid new warnings from -Winconsistent-missing-override · ccb229d5
      Jim Meyering authored
      Summary:
      Upgrading to clang:dev (clang >3.6) brought in some new warnings.
      This change address all of the issues exposed by the new
      -Winconsistent-missing-override, usually by simply adding the
      missing "override" keyword.  However, in
      folly/wangle/channel/test/MockChannelHandler.h, I chose
      to ignore those warnings for the mocked functions.
      * folly/futures/test/ViaTest.cpp: Add missing "override"(s).
      * folly/io/async/AsyncSSLSocket.h: Likewise.
      * folly/io/async/AsyncSocket.h: Likewise.
      * folly/io/async/EventBase.h: Likewise.
      * folly/test/ExceptionWrapperTest.cpp: Likewise.
      * folly/wangle/channel/AsyncSocketHandler.h: Likewise.
      * folly/wangle/channel/test/MockChannelHandler.h: Ignore
      the new warning for these functions.
      
      Test Plan:
      Run these commands and note there are fewer errors than before:
      fbconfig --clang --with-project-version=clang:dev -r folly && fbmake dbgo
      
      Reviewed By: hans@fb.com
      
      Subscribers: trunkagent, fugalh, folly-diffs@, jsedgwick, yfeldblum
      
      FB internal diff: D1848330
      
      Tasks: 6244745
      
      Signature: t1:1848330:1423858909:b167ca220d6c9fe036d3adca08cf3053a7a9de16
      ccb229d5
    • Hannes Roth's avatar
      (Wangle) Have Core own an FSM instead of inheriting · 09430395
      Hannes Roth authored
      Summary:
      This seems cleaner. I also moved a Core member around and changed state to be a smaller size to save us 16 bytes. Might be neat to try to get this down to 128?
      
      Fixed compilation with GCC 4.9, too.
      
      Test Plan: Ran all the tests. Will also benchmark.
      
      Reviewed By: hans@fb.com
      
      Subscribers: trunkagent, folly-diffs@, jsedgwick, yfeldblum
      
      FB internal diff: D1843129
      
      Signature: t1:1843129:1423789502:60e56d1af553994991195fcc350d37d644a556ca
      09430395
    • Jonathan Frank's avatar
      Be able to access proxy client IP (including Lua) · 96242018
      Jonathan Frank authored
      Summary:
      Pass TransportInfo object through connection setup.  This allows us to
      pass along additional info from the setup if necessary.
      
      Test Plan:
      Run proxygen on my devserver listening on ipv4 and ipv6 for ports 80 and 443.
      Configure it to run a lua request rule with the following lines:
      
      io.stderr:write("jonlog: proxy " .. conn:getClientAddrOriginal() .. "\n")
      io.stderr:write("jonlog: client " .. request:getClientIPStr() .. "\n")
      
      Run haproxy also on my devserver, listening on ports 8555-8558, with each
      forwarding to one of the four pairs (ipv4-localhost/ipv6-localhost, 80/443)
      
      From my laptop, run curls against each of these four endpoints and make
      sure that we print out "127.0.0.1" as the proxy IP, and my laptop's IP
      as the client IP.
      
      Reviewed By: cgheorghe@fb.com
      
      Subscribers: jsedgwick, yfeldblum, trunkagent, ruibalp, bmatheny, folly-diffs@, dsp, nbm
      
      FB internal diff: D1746590
      
      Tasks: 5688127
      
      Signature: t1:1746590:1423695880:f647964d95636a69a00304e144aef71ee0213d28
      96242018
    • Giuseppe Ottaviano's avatar
      Fix EliasFanoReader position() when past-the-end · c7c65f54
      Giuseppe Ottaviano authored
      Summary:
      `EliasFanoReader::position()` used to return `size() - 1` both when
      the reader is positioned on the last element, and after `next()` is
      called after that (and it return `false`). Now in the latter case
      `position()` returns `size()` (consistently with the usual behaviour
      of past-the-end iterators).
      
      Also fix the return type of `jumpTo`.
      
      Test Plan:
      fbconfig folly/experimental/test:eliasfano_test && fbmake runtests_opt
      
      Reviewed By: philipp@fb.com
      
      Subscribers: trunkagent, folly-diffs@, yfeldblum
      
      FB internal diff: D1846275
      
      Signature: t1:1846275:1423790264:151f5d2e1e09d4e24dfb758473dfb9cd52c070bd
      c7c65f54
    • Keith Adams's avatar
      std::atomicize MicroSpinLock. · c3ca39e2
      Keith Adams authored
      Summary:
      A colleague at another company started making fun of
      MicroSpinLock for its x86 assembly and ad hoc compiler memory
      barriers. Use C++11 (which wasn't really a thing at the time I wrote
      this).
      
      Test Plan: folly's runtests. What else would we like?
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      Subscribers: folly-diffs@, yfeldblum
      
      FB internal diff: D1841563
      
      Signature: t1:1841563:1423780458:a447c081fbd72e3420b23e95dcf26575c9a06798
      c3ca39e2
    • Giuseppe Ottaviano's avatar
      Elias-Fano micro-optimizations · c2c47da2
      Giuseppe Ottaviano authored
      Summary:
      Short skips have been optimized by adding special cases that use simple iteration when it is convenient. Large skips have been optimized by using the broadword selection algorithm by Vigna (improved with ideas by Gog&Petri) instead of iterating on the zeros/ones of the upper bits.
      
      The benchmarks had to be made more granular to measure the differences, in particular they used to test skipping with a fixed skip length for each test, while now we average over a range of skips to better simulate a random distribution.
      
      The improvements are very significant for `skipTo()` on short skips, about 2-3x for skips at distance 1 or 2, which can occur when intersecting dense lists. On large skips the gain is about 17%.
      
      `skip()` exhibits slightly smaller improvements.
      
      before               after
      ============================================================================  ==================
      folly/experimental/test/EliasFanoCodingTest.cpp relative  time/iter  iters/s  time/iter  iters/s
      ============================================================================  ==================
      Next                                                         2.52ns  396.26M     2.52ns  397.28M
      Skip_ForwardQ128(1)                                          8.66ns  115.52M     3.92ns  255.28M
      Skip_ForwardQ128(2)                                          8.37ns  119.42M     5.08ns  197.04M
      Skip_ForwardQ128(4_pm_1)                                     9.67ns  103.41M     7.04ns  142.02M
      Skip_ForwardQ128(16_pm_4)                                   21.44ns   46.65M    19.68ns   50.82M
      Skip_ForwardQ128(64_pm_16)                                  30.86ns   32.40M    27.58ns   36.26M
      Skip_ForwardQ128(256_pm_64)                                 37.80ns   26.45M    32.49ns   30.78M
      Skip_ForwardQ128(1024_pm_256)                               38.99ns   25.65M    33.39ns   29.95M
      Jump_ForwardQ128                                            37.91ns   26.37M    34.05ns   29.37M
      ----------------------------------------------------------------------------  ------------------
      SkipTo_SkipQ128(1)                                          13.87ns   72.10M     4.42ns  226.49M
      SkipTo_SkipQ128(2)                                          18.80ns   53.20M     8.58ns  116.55M
      SkipTo_SkipQ128(4_pm_1)                                     23.59ns   42.38M    11.43ns   87.50M
      SkipTo_SkipQ128(16_pm_4)                                    36.04ns   27.74M    31.19ns   32.06M
      SkipTo_SkipQ128(64_pm_16)                                   53.34ns   18.75M    43.88ns   22.79M
      SkipTo_SkipQ128(256_pm_64)                                  62.27ns   16.06M    49.08ns   20.37M
      SkipTo_SkipQ128(1024_pm_256)                                65.63ns   15.24M    52.24ns   19.14M
      JumpTo_SkipQ128                                             65.89ns   15.18M    54.61ns   18.31M
      ----------------------------------------------------------------------------  ------------------
      Encode_10                                                  111.94ns    8.93M   117.24ns    8.53M
      Encode                                                       5.35ms   187.02     5.64ms   177.15
      ----------------------------------------------------------------------------  ------------------
      Select64                                                     8.07ns  123.96M     8.04ns  124.35M
      ============================================================================  ==================
      
      Test Plan:
      fbconfig folly/experimental/test:eliasfano_test && fbmake runtests_opt
      
      Reviewed By: philipp@fb.com
      
      Subscribers: yfeldblum, fbcode-common-diffs@, chaoyc, search-fbcode-diffs@, unicorn-diffs@, trunkagent, folly-diffs@
      
      FB internal diff: D1793554
      
      Signature: t1:1793554:1423619344:1b078c0789639f317342ebcc77b11fe91859cd7b
      c2c47da2
    • Hannes Roth's avatar
      (Wangle) Catch all exceptions in `then() -> Future` · 3f653ebe
      Hannes Roth authored
      Summary: Saw this while debugging some stuff. Just an oversight, right?
      
      Test Plan: Ran all the tests.
      
      Reviewed By: hans@fb.com
      
      Subscribers: folly-diffs@, jsedgwick, yfeldblum
      
      FB internal diff: D1843016
      
      Signature: t1:1843016:1423704557:d9fdb4b879ab4fcfda54a5fcb16a639df15872b5
      3f653ebe
  2. 12 Feb, 2015 5 commits
    • Sara Golemon's avatar
      Bump version to 26:0 · 7d2497f0
      Sara Golemon authored
      7d2497f0
    • Tom Jackson's avatar
      Making 'just()' reference arguments like 'from()' (fixed) · 117c33c3
      Tom Jackson authored
      Summary: That is, for all inputs except r-values. Now with support for GCC.
      
      Test Plan: Run tests
      
      Reviewed By: ajaymenon@fb.com
      
      Subscribers: moharrami, trunkagent, folly-diffs@, yfeldblum
      
      FB internal diff: D1822339
      
      Signature: t1:1822339:1423683482:027871549d69017a7a23a675025851a0b876ad77
      117c33c3
    • Sara Golemon's avatar
      Remove unsed header from singleton-inl.h · 01d474df
      Sara Golemon authored
      Summary:
      This was recently added by @andrii to provide stack traces,
      but it no longer needed since he now produces them from a hook in
      folly/experimental/SingletonStackTrace.cpp
      
      Test Plan: Continues to build without the include.
      
      Reviewed By: andrii@fb.com
      
      Subscribers: folly-diffs@, yfeldblum, andrii
      
      FB internal diff: D1842654
      
      Signature: t1:1842654:1423696133:cfa91851f28696082f790eb13c3b0b015c813590
      01d474df
    • Nathan Bronson's avatar
      Revert "[folly] TLS cache for AccessSpreader" · 6a9fa4cf
      Nathan Bronson authored
      Summary:
      This reverts commit 4ebb2303bbcf343d7c2bcc95d55557c0a3b444f3.
      The caching mechanism was based on a misunderstanding of the
      implementation of CLOCK_MONOTONIC_COARSE, and is not correct.
      On the plus side, the upstream kernel patch
      
      e76b027e6408 x86,vdso: Use LSL unconditionally for vgetcpu
      
      gets the vdso getcpu from 16 nanos down to 10 (half of which is the
      inherent indirect call).
      
      Test Plan: unit tests
      
      Reviewed By: delong.j@fb.com
      
      Subscribers: trunkagent, bmaurer, tudorb, folly-diffs@, yfeldblum, jdelong
      
      FB internal diff: D1840690
      
      Signature: t1:1840690:1423693026:33801341ec0b83bf47e050be6528c5dd05021ed5
      6a9fa4cf
    • Andrii Grynenko's avatar
      Make Singleton dependency on Symbolizer Facebook-only · 01734a1c
      Andrii Grynenko authored
      Summary: Open-source build was broken because Symbolizer is not part of it.
      
      Test Plan: singleton unit test w/ and w/o SingletonStackTrace.cpp linked in.
      
      Reviewed By: alikhtarov@fb.com
      
      Subscribers: trunkagent, folly-diffs@, yfeldblum
      
      FB internal diff: D1840346
      
      Signature: t1:1840346:1423690004:926c2aa21e0b7916260749120997ad56fab6f742
      01734a1c
  3. 11 Feb, 2015 24 commits
    • Sara Golemon's avatar
      Bump version to 25:0 · 2d8581db
      Sara Golemon authored
      2d8581db
    • Sara Golemon's avatar
      Autodetect pthread_atfork() support · 07367f14
      Sara Golemon authored
      Summary: This is usually available on linux
      
      Test Plan: Existing tests and manual test on arclinux
      
      Reviewed By: mpawlowski@fb.com
      
      Subscribers: folly-diffs@, yfeldblum
      
      FB internal diff: D1840081
      
      Signature: t1:1840081:1423619986:911c95f9f04f286e9f113543ab4b705cf1b17396
      07367f14
    • Ranjeeth Dasineni's avatar
      remove stray / in include path · 7191014d
      Ranjeeth Dasineni authored
      Summary: removing // as it could break some comment parser
      
      Test Plan: unitz
      
      Reviewed By: dancol@fb.com
      
      Subscribers: trunkagent, doug, seanc, folly-diffs@, yfeldblum
      
      FB internal diff: D1830591
      
      Signature: t1:1830591:1423203436:9e8b28b714eb2dc080462ab3e8ce04c176df8586
      7191014d
    • Hans Fugal's avatar
      switch order of method/object in Future::then to match std::bind · d8bc4210
      Hans Fugal authored
      Summary:
      I have half a mind to just rip this out and let people use std::bind if they need this. But I won't be so cruel.
      
      Why isn't this just implemented as `then(std::bind(method, object))` anyway? Is the template soup we have now faster?
      
      Test Plan:
      Fixed the unit tests to use the new format.
      Will look to contbuild to catch all the things this might break (if anyone is using it at all?), and will fix them.
      
      Reviewed By: hannesr@fb.com
      
      Subscribers: trunkagent, exa, folly-diffs@, yfeldblum, jsedgwick, davejwatson
      
      FB internal diff: D1831118
      
      Signature: t1:1831118:1423243771:65db9a89daf14d8bd88331c503ba1ea7ab03b679
      d8bc4210
    • Hans Fugal's avatar
      futures::chain · e1c576b4
      Hans Fugal authored
      Summary:
      `futures::chain<A,Z>(a, b, c, d, e, f, ..., z)` where `a` is a callback suitable for `Future<A>::then` and `z` is a callback suitable for `Future<Y>::then<Z>`.
      
      This will be important, at least in the background, for the new `via`. It will probably also be useful to some user sometime.
      
      I imagine this will be tweaked over time if people find magic ways to get it to deduce the types better. But this works and it's not *too* much trouble to specify A and Z.
      
      Test Plan: unit
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: trunkagent, exa, folly-diffs@, yfeldblum, jsedgwick
      
      FB internal diff: D1831073
      
      Tasks: 6048744
      
      Signature: t1:1831073:1423259292:711be0e047a2acb706fd74e529d5d5fb6abda566
      e1c576b4
    • Andrii Grynenko's avatar
      folly::Singleton leak diagnostics utils · 9f502239
      Andrii Grynenko authored
      Summary: This adds different types of messages depending on whether Singleton was depending on other Singleton or just leaked. It also adds destruction stack trace for such Singletons (if they were ever destroyed) to help debug such leaks/broken dependencies.
      
      Test Plan: unit test
      
      Reviewed By: chip@fb.com
      
      Subscribers: trunkagent, folly-diffs@, yfeldblum
      
      FB internal diff: D1830526
      
      Signature: t1:1830526:1423266462:ba328b0da0bf4030b1c4f686d8f7b609fd20683c
      9f502239
    • Andrii Grynenko's avatar
      Making each SingletonEntry a singleton · 8f7c257f
      Andrii Grynenko authored
      Summary:
      Most of the singleton construction logic is moved to SingletonEntry, and each SingletonEntry is now also a singleton.
      SingletonVault becomes only responsible for keeping singleton construction order (and potentially dependencies) and destoying them in correct order.
      This also significantly improves perf of get() / get_weak() (not-fast)
      
      This diff is based on D1823663.
      
      Test Plan:
      unit test
      
      ============================================================================
      folly/experimental/test/SingletonTest.cpp       relative  time/iter  iters/s
      ============================================================================
      NormalSingleton                                            333.35ps    3.00G
      MeyersSingleton                                   99.99%   333.39ps    3.00G
      FollySingletonSlow                                49.99%   666.84ps    1.50G
      FollySingletonFast                                95.90%   347.61ps    2.88G
      FollySingletonFastWeak                             2.22%    15.00ns   66.66M
      ============================================================================
      
      Reviewed By: chip@fb.com
      
      Subscribers: trunkagent, folly-diffs@, yfeldblum
      
      FB internal diff: D1827390
      
      Signature: t1:1827390:1423268514:da322d1dcaba54905d478b253f26dd76f890fb4e
      8f7c257f
    • Philip Pronin's avatar
      make decodeVarint accept StringPiece · a11dc9b7
      Philip Pronin authored
      Summary: `decodeVarint` now accepts all of `StringPiece`, `MutableStringPiece`, `ByteRange`, and `MutableByteRange`.
      
      Test Plan: fbconfig -r folly unicorn/utils && fbmake runtests_opt -j32
      
      Reviewed By: ott@fb.com, lucian@fb.com
      
      Subscribers: trunkagent, chaoyc, search-fbcode-diffs@, unicorn-diffs@, folly-diffs@, yzhan, yfeldblum
      
      FB internal diff: D1836805
      
      Signature: t1:1836805:1423534085:cca5c3e83ad699e5d56e1d1e3394644ec3f94dab
      a11dc9b7
    • Andre Pinto's avatar
      typo · 2a9f8165
      Andre Pinto authored
      Summary: Correct typo on docs.
      
      Test Plan: N/A
      
      Reviewed By: alikhtarov@fb.com
      
      Subscribers: folly-diffs@, yfeldblum
      
      FB internal diff: D1836264
      
      Signature: t1:1836264:1423527402:4e5f263f446346f7145c33c671f0b9e694db15fd
      2a9f8165
    • Marcin Pawlowski's avatar
      fix open source build · 2657ebb5
      Marcin Pawlowski authored
      Summary:
      include was missing, causing build to fail on
      Arch Linux with gcc 4.9.2 -- found this while resolving
      other issues.
      
      Test Plan: build folly on my personal linux and on dev server
      
      Reviewed By: viswanath@fb.com
      
      Subscribers: fugalh, folly-diffs@, jsedgwick, yfeldblum
      
      FB internal diff: D1835143
      
      Signature: t1:1835143:1423513128:5dcff69a82878f47b40512711ed254f239399c2c
      2657ebb5
    • Andrii Grynenko's avatar
      Revert "Revert "Using type-tags for test SingletonVaults"" · 4d897276
      Andrii Grynenko authored
      Summary:
      This reverts commit 4893c09795ad4b1187518b184ac4812079039988.
      
      Fix unit test in D1823663.
      
      Test Plan: fbconfig -r folly fbmake dbg
      
      Reviewed By: alikhtarov@fb.com
      
      Subscribers: folly-diffs@, yfeldblum
      
      FB internal diff: D1832645
      
      Signature: t1:1832645:1423267466:6012f1d7700d540c7290c29b01b33148cf91183c
      4d897276
    • Nathan Bronson's avatar
      TLS cache for AccessSpreader · 5569e6fa
      Nathan Bronson authored
      Summary:
      Under Linux the process gtod doesn't contain the current cpu, so
      __vdso_getcpu uses RDTSCP, which makes it cost about 20 nanos.  The gtod
      _does_, however, contain a nanosecond time (for CLOCK_REALTIME_COARSE)
      updated during context switches.  This diff adds a TLS cache that uses
      __vdso_clock_gettime_ns(CLOCK_REALTIME_COARSE) to detect context switches.
      The end result is that AccessSpreader goes from ~20 nanos to ~6.
      
      Test Plan: unit tests
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: yfeldblum, trunkagent, folly-diffs@
      
      FB internal diff: D1798922
      
      Signature: t1:1798922:1423264298:32312a5e9bddb3b8aa630c146ef708164a6a4651
      5569e6fa
    • Nicholas Ormrod's avatar
      Revert "Using type-tags for test SingletonVaults" · b2f445a2
      Nicholas Ormrod authored
      Summary: This reverts commit 315cfed207895455ecd359d0c1b9d98f28ed0519.
      
      Test Plan:
      fbconfig -r folly && fbmake dbg
      
      Reviewed By: robbert@fb.com
      
      Subscribers: sdwilsh, folly-diffs@, yfeldblum
      
      FB internal diff: D1831932
      
      Signature: t1:1831932:1423258329:0962b939a93bbf1722a9e1c90090dcc024b63765
      
      Blame Revision: D1823663
      b2f445a2
    • Yedidya Feldblum's avatar
      Dedupe the implementations of EventBase::runInEventBaseThreadAndWait. · 777002cb
      Yedidya Feldblum authored
      Summary: [Folly] Dedupe the implementations of EventBase::runInEventBaseThreadAndWait.
      
      Test Plan:
      Unit tests:
      * `folly/io/async/test/EventBaseTest.cpp`
      
      Reviewed By: subodh@fb.com
      
      Subscribers: trunkagent, folly-diffs@, yfeldblum, dougw, brettp
      
      FB internal diff: D1826291
      
      Signature: t1:1826291:1423225534:42264d8dcc8adec6b90ac8a3d6ce1f4b98f29297
      
      Blame Revision: D1810764, D1823407
      777002cb
    • Andrii Grynenko's avatar
      Using type-tags for test SingletonVaults · 75d52926
      Andrii Grynenko authored
      Summary: This makes test SingletonVaults more similar to global SingletonVault. It also ensures that every SingletonVault is a singleton, which allows potential optimization of making each SingletonEntry a Singleton too, which itself will make get/get_weak as efficient as get_fast/get_weak_fast.
      
      Test Plan: unit test
      
      Reviewed By: chip@fb.com
      
      Subscribers: folly-diffs@, yfeldblum
      
      FB internal diff: D1823663
      
      Signature: t1:1823663:1423188884:4ab2b47cfba270a66613f6f2458b6affc0ed96ad
      75d52926
    • Hans Fugal's avatar
      make wait() and friends return reference to self instead of new Future · 2aa1ef48
      Hans Fugal authored
      Summary:
      we still make the new Future, but assign it to ourselves. this avoids the following buggy pattern that people might expect to work
      
      ```
      auto f = ...
      f.wait();
      
      // Careful. f.value() was moved out into the new Future, so you may have lost something
      someOperationOn(f.value());
      
      // Nope. We already set a callback internally in wait()
      f.then(...);
      ```
      
      Test Plan: unit
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: exa, yfeldblum, trunkagent, fbcode-common-diffs@, sammerat, cold-storage-diffs@, folly-diffs@, jsedgwick, aflock
      
      FB internal diff: D1809040
      
      Tasks: 6048284
      
      Signature: t1:1809040:1422900812:1b416408eb5eaa71e88778c9c22ed8bfba087efe
      2aa1ef48
    • Andrei Alexandrescu's avatar
      Add StringKeyed(Unordered){Set,Map} to folly · 1474b109
      Andrei Alexandrescu authored
      Summary: We're using StringKeyed* from common/datastruct to avoid unnecessary string creation whenever we're looking up string keys. C++14 does offer a solution, see e.g. http://stackoverflow.com/questions/10536788/avoiding-key-construction-for-stdmapfind. That is not supported by current compilers.
      
      Test Plan: unittests
      
      Reviewed By: pavlo@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@, yfeldblum
      
      FB internal diff: D1825700
      
      Signature: t1:1825700:1423086724:530550c3c80e33c80900f31c0ade05c66b22cbe8
      1474b109
    • Andrei Alexandrescu's avatar
      Disallow assignment to rvalue Range objects (and StringPiece in particular) · 7eaace04
      Andrei Alexandrescu authored
      Summary:
      Before this diff the code below compiled and did absolutely nothing of interest:
      
      StringPiece fun();
      ...
      fun() = "hello";
      
      i.e. assignment to an rvalue range was allowed. Such code is almost always, if not always, in error. This diff fixes that.
      
      Test Plan: ran unittests
      
      Reviewed By: ldbrandy@fb.com
      
      Subscribers: mpawlowski, net-systems@, folly-diffs@, yfeldblum
      
      FB internal diff: D1825360
      
      Signature: t1:1825360:1423097817:fdaaf893cd1abbe71dc857a315df7c45cb6a0bd0
      7eaace04
    • Darren Mo's avatar
      Subprocess Process Group Improvements · 5079904b
      Darren Mo authored
      Summary: Eliminated a potential race condition by removing unnecessary code.
      
      Test Plan: Unit tests pass.
      
      Reviewed By: lesha@fb.com
      
      Subscribers: tudorb, trunkagent, folly-diffs@, yfeldblum
      
      FB internal diff: D1824924
      
      Signature: t1:1824924:1423102017:6bce388dccf9126d6ac3a1741d8300a51c5276ed
      
      Blame Revision: D1492526
      5079904b
    • Yedidya Feldblum's avatar
      Avoid EventBase depending on Baton (mutex/condvar variant). · 31d4d5d6
      Yedidya Feldblum authored
      Summary: [Folly] Avoid EventBase depending on Baton (mutex/condvar variant).
      
      Test Plan:
      Unit tests:
      * folly/io/async/test/EventBaseTest.cpp
      
      Reviewed By: subodh@fb.com
      
      Subscribers: trunkagent, fma, folly-diffs@, yfeldblum, dougw, brettp
      
      FB internal diff: D1823407
      
      Signature: t1:1823407:1423088450:71ae1673ed8067103e2aaa1ac9b239eae9ebe9de
      
      Blame Revision: D1810764
      31d4d5d6
    • Hans Fugal's avatar
      Fix comment · b6741322
      Hans Fugal authored
      Summary: It is true. Also, add a useful message about which thread this Future will complete in.
      
      Test Plan: it should still compile
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: trunkagent, exa, folly-diffs@, jsedgwick, yfeldblum
      
      FB internal diff: D1819849
      
      Tasks: 5705286, 6008465
      
      Signature: t1:1819849:1423074012:79bf11c877eb2f061cb5d07f7ab45fa4cc4a894b
      b6741322
    • Hans Fugal's avatar
      Future<T>::onTimeout(Duration, function<T()>, Timekeeper*=nullptr) · dc64cee6
      Hans Fugal authored
      Summary:
      (or func returns Future<T>)
      
      Invoke and respond to a timeout with a callback, rather than using `within` and adding `onError` or `then` or something.
      
      Test Plan: new tests
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: jsedgwick, yfeldblum, trunkagent, fugalh, exa, folly-diffs@
      
      FB internal diff: D1763174
      
      Tasks: 4548494
      
      Signature: t1:1763174:1423074062:05cec1dfb1110b31b599033949ebe0ee70dd0552
      dc64cee6
    • Hans Fugal's avatar
      Fix another comment · eaed836c
      Hans Fugal authored
      Summary:
      I don't know what this paragraph is even saying. It looks like
      copypasta
      
      Test Plan: still compiles or my uncle is a monkey
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: trunkagent, exa, folly-diffs@, jsedgwick, yfeldblum
      
      FB internal diff: D1819905
      
      Tasks: 5705286
      
      Signature: t1:1819905:1423074021:a095fe2a17d5698678a527b60c9384625df869fd
      eaed836c
    • Tom Jackson's avatar
      Fixing find_first_of O(n) case · c7e6c224
      Tom Jackson authored
      Summary:
      The `memchr()`-based `find_first_of()` behaves extremely badly when it's used in a loop and the input string doesn't contain all the needles. This was discovered when a reasonable line-breaking routine tried to use it to break lines by a mix of '\r' and '\n'. The entire remainder of the file was scanned each time a line was read.
      
      Before:
      
      ```
      CountDelimsBase                    1.26s   794.86m
      CountDelimsNoSSE         100.03%   1.26s   795.12m
      CountDelimsStd         40501.63%   3.11ms  321.93
      CountDelimsMemchr         98.31%   1.28s   781.41m
      CountDelimsByteSet     23162.41%   5.43ms  184.11
      ```
      
      After:
      
      ```
      CountDelimsBase                   3.20ms  312.08 <-- Base impl no longer considers memchr
      CountDelimsNoSSE         102.37%  3.13ms  319.47
      CountDelimsStd           103.19%  3.11ms  322.05
      CountDelimsMemchr          0.25%  1.27s   788.39m
      CountDelimsByteSet        59.68%  5.37ms  186.27
      ```
      
      Test Plan: Benchmarks
      
      Reviewed By: njormrod@fb.com
      
      Subscribers: folly-diffs@, yfeldblum
      
      FB internal diff: D1823536
      
      Signature: t1:1823536:1423081687:bb2ec8cdea477ee9b9c8d8ad2bfdecdc52657515
      c7e6c224