1. 18 Dec, 2014 15 commits
    • Adam Simpkins's avatar
      SpinLock improvements · e4ef6050
      Adam Simpkins authored
      Summary:
      This makes several improvements to the SpinLock code:
      
      - Add a SpinLock implementation using pthread_spinlock_t.  On non-x86_64
      platforms this is preferred over the pthread_mutex_t implementation
      when available.
      
      - For the pthread implementations, throw std::system_error on error,
      rather than completely aborting the program using glog's CHECK()
      macros.
      
      - Update the pthread_mutex_t implementation to call
      pthread_mutex_destroy() on destruction.
      
      - Always unit test all implementations that can be compiled on the
      current build platform, even though only a single implementation will
      be selected as folly::SpinLock.  This way x86_64 builds will still
      unit test the pthread-based implementations.
      
      Test Plan: Ran the unit tests.
      
      Reviewed By: seanc@fb.com
      
      Subscribers: trunkagent, doug, net-systems@, exa, folly-diffs@
      
      FB internal diff: D1735770
      
      Signature: t1:1735770:1418445953:b238aa8fb835a8d55e6e98e20c4615ae1938b98f
      e4ef6050
    • Adam Simpkins's avatar
      remove PortableSpinLock.h · 6b3d35fc
      Adam Simpkins authored
      Summary:
      Remove the PortableSpinLock header file now that all call sites have
      been migrated to the new SpinLock name.
      
      Test Plan: Built and ran unit tests for folly, thrift, and proxygen.
      
      Reviewed By: seanc@fb.com
      
      Subscribers: trunkagent, doug, net-systems@, exa, folly-diffs@
      
      FB internal diff: D1734685
      
      Signature: t1:1734685:1418335405:e834f64d7282393e942a1de3638f4cf67410eaab
      6b3d35fc
    • Adam Simpkins's avatar
      update call sites to use SpinLock · 87520af5
      Adam Simpkins authored
      Summary:
      Update call sites to use the new folly::SpinLock name, instead of
      folly::io::PortableSpinLock.
      
      Test Plan: Built and ran the folly unit tests.
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: doug, net-systems@, exa, folly-diffs@
      
      FB internal diff: D1734647
      
      Signature: t1:1734647:1418334925:1bbcffccd06907224de2a102f8d4bfbe1bd62fd1
      87520af5
    • Adam Simpkins's avatar
      rename io::PortableSpinLock to SpinLock · 4494e275
      Adam Simpkins authored
      Summary:
      folly::io::PortableSpinLock seems generally useful outside of the io
      code.  This moves it into the base folly namespace, and renames it from
      PortableSpinLock to just SpinLock.
      
      For most users, the main difference between MicroSpinLock and SpinLock
      is that SpinLock provides a constructor that does the right thing, while
      MicroSpinLock has to be explicitly initialized.
      
      Test Plan:
      Added some new unit tests, and tested both the MicroSpinLock and
      pthread_spinlock_t implementations.  I didn't test the Mac OS version,
      although that code remains unchanged.
      
      Reviewed By: seanc@fb.com
      
      Subscribers: trunkagent, doug, net-systems@, exa, folly-diffs@
      
      FB internal diff: D1734632
      
      Signature: t1:1734632:1418394033:99f6fbe73b485a1d631a2ef7d1b39ea6f49ecb0b
      4494e275
    • Andrii Grynenko's avatar
      get_fast/get_weak_fast API for folly::Singleton · 249e3805
      Andrii Grynenko authored
      Summary: This adds API which makes folly::Singleton as performant as Meyers/static-object singletons.
      
      Test Plan:
      unit test + benchmark
      
      ============================================================================
      folly/experimental/test/SingletonTest.cpp       relative  time/iter  iters/s
      ============================================================================
      NormalSingleton                                            333.32ps    3.00G
      MeyersSingleton                                  100.00%   333.33ps    3.00G
      FollySingletonSlow                                 0.35%    94.36ns   10.60M
      FollySingletonFast                                99.43%   335.24ps    2.98G
      FollySingletonFastWeak                             0.62%    53.74ns   18.61M
      ============================================================================
      
      Reviewed By: alikhtarov@fb.com
      
      Subscribers: trunkagent, folly-diffs@
      
      FB internal diff: D1741961
      
      Signature: t1:1741961:1418765462:d9806f1bf5275bfbe2c4c53a41b735bda93753fe
      249e3805
    • Cameron Pickett's avatar
      Add specific multi-bind to AsyncServerSocket · adc966e1
      Cameron Pickett authored
      Summary:
      Add a bind api similar to binding by port across all interfaces.
      However, this bind will only attempt to bind sockets to the supplied
      IP addresses. I'd like to add this to aid in moving TURN to IPv6.
      
      TURN will use two specified addresses, one for IPv4, and one for IPv6, to
      handle incoming connections from clients. In order to avoid duplicating
      workers, we'd like to take advantage of the multi-socket implementation
      of AsyncServerSocket. However, we don't want to bind to all interfaces,
      especially for port 443.
      
      Test Plan:
      Plan to test by adapting TurnTcpListener to use this new API. See that
      1. using one address still works as expected,
      2. using zero addesses will cause exception
      3. using multiple addresses works as expected
      
      Will write unit tests if needed
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: hannesr, trunkagent, net-systems@, folly-diffs@, naizhi
      
      FB internal diff: D1729442
      
      Tasks: 3633642
      
      Signature: t1:1729442:1418752467:22a60da4ec9009ea0b7fe28a8a436a179e0449aa
      adc966e1
    • Nathan Bronson's avatar
      fix Futex when steady_clock and system_clock precisions differ · 1a608d58
      Nathan Bronson authored
      Summary:
      To handle the strange relationship between steady_clock and
      system_clock (on some platforms these represent only one type, on some
      platforms they are separate) Futex::futexWaitUntil converts the deadline
      to a duration and back.  On Xcode 6 system_clock is measured in
      microseconds and steady_clock in nanoseconds, resulting in a compilation
      failure.  This diff fixes it.
      
      Test Plan:
      1. compile snippet manually using Xcode
      2. new unit test that causes the same implicit conversion failure in a slightly different way
      
      Reviewed By: mssarang@fb.com
      
      Subscribers: trunkagent, folly-diffs@
      
      FB internal diff: D1740903
      
      Tasks: 5831196
      
      Signature: t1:1740903:1418754770:32c999abf1dc87415ffebf45083a903abbded9f2
      1a608d58
    • James Sedgwick's avatar
      codemod: folly/wangle/ -> folly/wangle/futures · f2ac9a5c
      James Sedgwick authored
      Summary: Last thing before moving experimental/wangle here. Once everything is in the same directory I'm probably going to consolidate experimental/wangle/concurrent with the executors in this directory into wangle/executors/. And probably rename some of these targets. For now, a dumb move is enough.
      
      Test Plan: waiting for contbuild
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: trunkagent, fbcode-common-diffs@, chaoyc, search-fbcode-diffs@, lars, ruibalp, hero-diffs@, zeus-diffs@, vikas, danielg, mcduff, cold-storage-diffs@, unicorn-diffs@, ldbrandy, targeting-diff-backend@, netego-diffs@, fugalh, adamsyta, atlas2-eng@, alandau, bmatheny, adityab, everstore-dev@, zhuohuang, sweeney, mwa, jgehring, smarlow, akr, bnitka, jcoens, luk, zhguo, jying, apodsiadlo, alikhtarov, fuegen, dzhulgakov, mshneer, folly-diffs@, wch, tingy, hannesr
      
      FB internal diff: D1740327
      
      Tasks: 5802833
      
      Signature: t1:1740327:1418752541:82d7486293b0a12938730ae66d480c120aded4dc
      f2ac9a5c
    • Andrii Grynenko's avatar
      Remove locking when getting ptr to Singleton · 67bc1788
      Andrii Grynenko authored
      Summary: This removes one layer on locking on the fast path, when ptr to singleton object is read from SingletonEntry.
      
      Test Plan:
      unit test
      
      Before:
      
      ============================================================================
      folly/experimental/test/SingletonTest.cpp       relative  time/iter  iters/s
      ============================================================================
      NormalSingleton                                            335.26ps    2.98G
      MeyersSingleton                                   99.50%   336.96ps    2.97G
      FollySingleton                                     0.28%   120.64ns    8.29M
      ============================================================================
      
      After:
      
      ============================================================================
      folly/experimental/test/SingletonTest.cpp       relative  time/iter  iters/s
      ============================================================================
      NormalSingleton                                            336.76ps    2.97G
      MeyersSingleton                                   99.91%   337.07ps    2.97G
      FollySingleton                                     0.36%    92.69ns   10.79M
      ============================================================================
      
      Reviewed By: alikhtarov@fb.com
      
      Subscribers: trunkagent, folly-diffs@
      
      FB internal diff: D1727604
      
      Signature: t1:1727604:1418701171:1728b516191a8ec4439e981d78634370b4bcf7a1
      67bc1788
    • James Sedgwick's avatar
      global io executor · 3490aa71
      James Sedgwick authored
      Summary:
      This is something we've talked about for a while. It's also an alternative to the mechanism in D1714645.
      If we like it, I'll do something similar for a global cpu executor. That functionality should probably just be
      baked into Executor itself instead of a separate subclass, which is why the IOExecutor stuff is in Executor.h/.cpp,
      because it'll be pretty similar. The main exception is that for getCPUExecutor() you could return a default global
      InlineExecutor instead of exploding as in getIOExecutor()
      
      Test Plan: wangle unit, will start plumbing this into the services in #5003045 if we like it
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: hannesr, trunkagent, fugalh, alandau, mshneer, folly-diffs@, bmatheny
      
      FB internal diff: D1727894
      
      Tasks: 5002442
      
      Signature: t1:1727894:1418344077:9e54088a6acb3f78e53011a32fd1dfe8b3214c1d
      3490aa71
    • James Sedgwick's avatar
      move wangle/Executor.h to folly/ root · 973d5f61
      James Sedgwick authored
      Summary:
      this removes the dep EventBase has on wangle as we prepare to split off wangle
      also changes namespace from folly::wangle to folly
      
      Test Plan: just a couple of codemods so waiting for contbuild
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: trunkagent, fbcode-common-diffs@, chaoyc, search-fbcode-diffs@, zeus-diffs@, nli, cold-storage-diffs@, unicorn-diffs@, targeting-diff-backend@, hannesr, vighnesh, fugalh, alandau, bmatheny, adityab, zhuohuang, luk, darshan, gunjan, hdoshi, dzhulgakov, alihussains, panin, ves, mshneer, folly-diffs@, lins, nimishshah
      
      FB internal diff: D1737376
      
      Tasks: 5802833
      
      Signature: t1:1737376:1418423430:82d219c34fcc50218c380a17435e5880e53db6bd
      973d5f61
    • Chip Turner's avatar
      Improve performance of stringPrintf and related functions · 70d6b0b6
      Chip Turner authored
      Summary:
      It turned out at least one optimization we were doing for
      stringPrintf (using the tail of the input buffer) was causing a
      performance degradation in some cases -- if the string was already
      pre-sized, our resize() call would end up memset'ing the tail.  In some
      instances, this could cause significant performance penalties, such as
      when multiple stringAppendf calls were made.
      
      So, this diff removes the "optimization" around using the tail of the input
      buffer and instead uses a standalone stack buffer.  If vsnprintf deems
      that buffer too small, a heap buffer is instead used.
      
      As there is no std::string method that resizes the string to fill the
      underlying buffer without setting the values to a default, and as it is
      not legal to write past the end of the data buffer (even if capacity()
      says there is enough), let's just abandon that optimization.  It turns
      out this doesn't have a major performance loss for most cases since,
      with this diff, most small strings will fit on-stack and then hopefully
      in the string's tail anyway.
      
      Test Plan: runtests
      
      Reviewed By: simpkins@fb.com
      
      Subscribers: trunkagent, net-systems@, lins, anca, folly-diffs@
      
      FB internal diff: D1733774
      
      Tasks: 5735468
      
      Signature: t1:1733774:1418323943:ec47007c9756aca6cf0466bce92722ac4c7e89b2
      70d6b0b6
    • Andrew Chalfant's avatar
      Add convenience method for folly::join · a33734e4
      Andrew Chalfant authored
      Summary: While folly has join methods that return a string (and thus don't need a string referenced passed), it does not support this idiom with iterators. This diff adds support for calls like folly::join("/", itr.begin(), itr.end() - 1).
      
      Test Plan: Unit test
      
      Reviewed By: njormrod@fb.com
      
      Subscribers: philipp, trunkagent, njormrod, folly-diffs@, yfeldblum
      
      FB internal diff: D1702892
      
      Tasks: 5691439
      
      Signature: t1:1702892:1418344206:9c1736f5d8e41be1df71a415e3803fe846b387b7
      a33734e4
    • Dave Watson's avatar
      AsyncUDPSocket · 430a2ed1
      Dave Watson authored
      Summary:
      Move AsyncUDPSocket to folly.
      
      There is also one under realtime/voip/async that looks functionaly equivalent?  I think this one is only used in gangplank currently.
      
      Test Plan: contbuild
      
      Reviewed By: hans@fb.com
      
      Subscribers: trunkagent, doug, alandau, bmatheny, njormrod, mshneer, folly-diffs@
      
      FB internal diff: D1710675
      
      Tasks: 5788116
      
      Signature: t1:1710675:1417477000:9aebb466757554a5fa49d7c36cb504b4d8711b68
      430a2ed1
    • Chip Turner's avatar
      Improve benchmarking around stringPrintf functions · 6a1addcc
      Chip Turner authored
      Summary:
      Before optimizing this code, it is better to measure different
      aspects of it to ensure improvements are worth it and don'tintroduce
      other regressions.
      
      This adds a new benchmark as well as parameterizes an old one.
      
      Test Plan: run it
      
      Reviewed By: lovro@fb.com
      
      Subscribers: lins, anca, folly-diffs@
      
      FB internal diff: D1733760
      
      Tasks: 5735468
      
      Signature: t1:1733760:1418313479:9f572d5a4cf014bd266d91d0f7a75407d1514f65
      6a1addcc
  2. 11 Dec, 2014 25 commits
    • Dave Watson's avatar
      Bump version to 18:0 · 61e26ae9
      Dave Watson authored
      61e26ae9
    • James Sedgwick's avatar
      formatting nits in Executor.h · 6ecb0cd2
      James Sedgwick authored
      Summary:
      sorry this was bothering me
      also remove extra include
      
      Test Plan: OK
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: fugalh, folly-diffs@
      
      FB internal diff: D1733723
      
      Signature: t1:1733723:1418312030:088eb084f69e2bd7703724464b2f3e71abc2607a
      6ecb0cd2
    • James Sedgwick's avatar
      future_* callbacks in ThreadManager thread · c2132bba
      James Sedgwick authored
      Summary:
      This is a squashed diff consisting of the following approved diffs
      
      D1714007
      D1714645
      D1715686
      D1719963
      D1720725
      D1721838
      D1721856
      D1721920
      D1721956
      D1724910
      D1728289
      
      - execute future_* handlers in TM thread
      - call async thrift clients from any thread, not just EB thread
      - store a request's EventBase in the RequestContext for easier client management
      * this last one will change in favor of using a global IO executor but this should still land as an intermediate step. See D1727894
      
      Test Plan: see component diff test plans. otherwise, contbuild.
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: trunkagent, ruibalp, targeting-diff-backend@, hannesr, alandau, prometheus-diffs@, jeremyfein, mshneer, folly-diffs@, bmatheny, tingy
      
      FB internal diff: D1732289
      
      Tasks: 5003045, 5645785
      
      Signature: t1:1732289:1418253508:30b724a91717cf7fe21029e0a1eaf239db1650be
      c2132bba
    • Nicholas Ormrod's avatar
      ConcurrentSkipList Bug · eae5ede6
      Nicholas Ormrod authored
      Summary:
      Bug reported by Yan Lin (not a facebook employee) through @robbert.
      
      @philipp and @jdelong: you are the only two remaining facebookers to have
      made non-trivial changes to this code.
      
      Description of bug: layer 0 is 1->4, and we're looking for 3. We pass
      over 4, and see that 1 is less than 3 in the for loop. Now a race
      condition: another thread inserts 2, so layer 0 is now 1->2->3. Then,
      since ht==0, we return pred->skip(0), which is now 2 instead of 4.
      
      Why this is bad: it really breaks the lower_bound function (lower_bound
      calls findNode calls findNodeDownRight), since it returns an element
      that is lesser.
      
      This patch doesn't change the behavior of the code in the normal case;
      it just recycles previously-computed values so that this race condition
      doesn't crash and burn.
      
      Patch based off of Yan Lin's in-email suggestion.
      
      Test Plan:
      fbconfig -r folly && fbmake runtests
      
      Reviewed By: philipp@fb.com
      
      Subscribers: sdwilsh, folly-diffs@, jdelong, robbert, philipp
      
      FB internal diff: D1732434
      
      Signature: t1:1732434:1418260198:8c707435825cfa2a1093b681e066f320193e98f2
      eae5ede6
    • Brian Watling's avatar
      Fix clang compilation · df5336c8
      Brian Watling authored
      Summary: Fix shadowed variable name
      
      Test Plan: compile
      
      Reviewed By: mmandal@fb.com
      
      Subscribers: fugalh, mathieubaudet, folly-diffs@
      
      FB internal diff: D1732033
      
      Signature: t1:1732033:1418250864:d460fea376ac93c05b86977629b95dac60b8b916
      df5336c8
    • Dave Watson's avatar
      Only test multi accept if reuse port supported · 4ffad0ef
      Dave Watson authored
      Summary: Some contbuild machines aren't on 3.10 yet.
      
      Test Plan:
      fbconfig folly/experimental/wangle/bootstrap; fbmake runtests
      tested on 3.2 and 3.10
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: doug, fugalh, folly-diffs@
      
      FB internal diff: D1732040
      
      Tasks: 5800250
      
      Signature: t1:1732040:1418250452:a3203ab5769494594f2bf0b50f1c62052ddeb24c
      4ffad0ef
    • Sean Cannella's avatar
      Support -Wsign-compare compilation · db376afe
      Sean Cannella authored
      Summary:
      Due to how Conv.h uses the less_than template inside
      not-actually-static static ifs clang still ends up validating generated
      code inside a FOLLY_RANGE_CHECK which is never executed due to the
      templated types. This code however still generates -Wsign-compare issues
      so suppress that in order to allow includers to use this flag.
      
      A simple example will illustrate this:
      
      uint64_t foo = 1;
      int bar = folly::to<int>(foo);
      
      Test Plan: fbmake runtests
      
      Reviewed By: meyering@fb.com, njormrod@fb.com
      
      Subscribers: trunkagent, folly-diffs@, bmatheny, ranjeeth, subodh, kmdent, fma, shikong, pgriess, jdelong
      
      FB internal diff: D1731411
      
      Signature: t1:1731411:1418243200:ed1f34a1485669c9cb18f9f6029aca70e498953c
      db376afe
    • Brian Watling's avatar
      Use an IO thread pool executor by default · 25e200e2
      Brian Watling authored
      Summary:
      Remove member variable name shadowing
      
      Facebook: This diff adds a default executor for async requests which do not specify one. This ensures we don't run request callbacks on the event threads (which in turn ensures we don't make blocking tcc calls from the event threads)
      
      Test Plan: fbconfig tao/client; fbmake runtests
      
      Reviewed By: hannesr@fb.com
      
      Subscribers: hannesr, fugalh, zhuohuang, folly-diffs@, tao-eng@
      
      FB internal diff: D1731078
      
      Tasks: 5752037
      
      Signature: t1:1731078:1418237801:5b9bbe74c288292d5e7c7e6a38e67be864627d89
      25e200e2
    • Adrian Hamza's avatar
      Add mock singleton injection support to folly/experimental Singleton (t5653148). · accea1ae
      Adrian Hamza authored
      Summary: Add mock singleton injection support to folly/experimental Singleton (t5653148).
      
      Test Plan:
      Added unit tests for MockSingleton, all unit tests passed.
      Validated this works for my scenario.
      
      Reviewed By: andrii@fb.com
      
      Subscribers: trunkagent, njormrod, folly-diffs@
      
      FB internal diff: D1690946
      
      Tasks: 5653148
      
      Signature: t1:1690946:1418080331:948d7051a5e5a2653dc393c123f188c56072c6db
      accea1ae
    • davejwatson's avatar
      Multi accept · e5f8a09e
      davejwatson authored
      Summary: Use acceptor pool instead of current thread for accepts.  Use reuse_port option to support multiple threads
      
      Test Plan: Updated unittests
      
      Reviewed By: hans@fb.com
      
      Subscribers: doug, fugalh, njormrod, folly-diffs@
      
      FB internal diff: D1710619
      
      Tasks: 5788110
      
      Signature: t1:1710619:1417477350:eee5063186e582ef74c4802b8149563af029b3de
      e5f8a09e
    • Philip Pronin's avatar
      fix Cursor::skipAtMostSlow bug introduced in D1724111 · 49374068
      Philip Pronin authored
      Test Plan: fbconfig -r folly/io/test && fbmake runtests_opt -j32
      
      Reviewed By: viswanath@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1728927
      
      Tasks: 5788015
      
      Signature: t1:1728927:1418161580:9ed66412e35c62486a56e19aa9bf119863b5f1a1
      
      Blame Revision: D1724111
      49374068
    • Dave Watson's avatar
      Add REUSEPORT option to AsyncServerSocket · 010f9408
      Dave Watson authored
      Summary:
      Adds a reuse port option to AsyncServerSocket, so multiple sockets can bind to the same accept port.  Allows for multiple accept threads, so accepts can be greater, since there is no longer a single accept lock.
      
      reuse port option is ifdefd, since this wouldn't build with some of the older kernels otherwise.
      
      Postponed overnight
      
      Test Plan: Builds.  Used in an upcoming diff.
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: benj, trunkagent, doug, njormrod, folly-diffs@
      
      FB internal diff: D1710600
      
      Tasks: 5488516, 5788110
      
      Signature: t1:1710600:1418066966:627e03857f9b5ff831f2922add08e90cc525c95c
      010f9408
    • Sean Cannella's avatar
      TransportInfo size mismatches · e43f826e
      Sean Cannella authored
      Summary:
      The code that uses TransportInfo assumes these byte counts are
      compatible with size_t so make them so.
      
      Test Plan: compiled
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: fugalh, bmatheny, njormrod, folly-diffs@, benyluo, ranjeeth, fma, kmdent
      
      FB internal diff: D1725026
      
      Tasks: 5538843
      
      Signature: t1:1725026:1418061933:b4072ca926e792716776ddc00d79db9376510859
      e43f826e
    • Dave Watson's avatar
      set internal thread factory · 2a15a6c6
      Dave Watson authored
      Summary: Fix up a TODO
      
      Test Plan: ??  Should I bother with a test?
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: doug, fugalh, njormrod, folly-diffs@
      
      FB internal diff: D1710633
      
      Signature: t1:1710633:1417469890:9e8513140bae79da384c9d5418d4ea0840efbe6c
      2a15a6c6
    • Dave Watson's avatar
      Set a better default for maxReadsPerEvent · 142752b4
      Dave Watson authored
      Summary:
      0 (infinity) seems like a bad default for this.  Just found a 2~5% latency win in thrift by setting this to something more reasonable.  Any reason not to set a better default globally?
      
      Since this is already on for mcrouter/proxygen/thrift, the biggest change would probably be service router
      
      tests postponed longer than 20 minutes
      
      Test Plan:
      thrift perf test, multifeed canary
      
      Canary URL: https://our.intern.facebook.com/intern/feedtools/mycanary?id=davejwatson_20141208-102635_local.1418063194_d201eceec04e5e097a6dffb645a424d502db8742_
      
      Reviewed By: afrind@fb.com
      
      Subscribers: doug, net-systems@, njormrod, folly-diffs@, jsedgwick, haijunz, andrewcox, alandau, fugalh
      
      FB internal diff: D1725142
      
      Signature: t1:1725142:1418066284:c2e1cbf27b0c7a98cf2395f369683bbcce4cdce4
      142752b4
    • Dave Watson's avatar
      Bump up log level · 3277708e
      Dave Watson authored
      Summary: This log was getting annoying in tests, bump up the logging level
      
      Test Plan: contbuild
      
      Reviewed By: afrind@fb.com
      
      Subscribers: trunkagent, doug, fugalh, njormrod, folly-diffs@
      
      FB internal diff: D1710608
      
      Signature: t1:1710608:1417468546:770dfb7201ff6477b349c01e638f704a2ef1b7ce
      3277708e
    • Shijin Kong's avatar
      fix local variable shadow · 61a454f2
      Shijin Kong authored
      Summary:
      D1720014 line 183 in HHWheelTimer.h broke proxygen/facebook/httpclient clang build:
      
      ./folly/io/async/HHWheelTimer.h:183:17: error: declaration shadows a local variable [-Werror,-Wshadow]
      Wrapper(F fn) : fn_(std::move(fn)) {}
      ^
      ./folly/io/async/HHWheelTimer.h:181:28: note: previous declaration is here
      void scheduleTimeoutFn(F fn, std::chrono::milliseconds timeout) {
      
      I renamed the `fn` in `Wrapper` to `f`.
      
      Test Plan: pass
      
      Reviewed By: seanc@fb.com
      
      Subscribers: njormrod, folly-diffs@, subodh, seanc, kmdent, fma
      
      FB internal diff: D1724835
      
      Signature: t1:1724835:1418052896:d9a72230d4fd1a4a734a33142966fe796f4fd362
      61a454f2
    • Philip Pronin's avatar
      improve io::Cursor read() performance for small sizeof(T) · 173356a3
      Philip Pronin authored
      Summary:
      I just found that gcc (4.8.2) failed to unroll the loop in
      `pullAtMost()`, so it didn't replace `memcpy` with a simple load
      for small `len`.
      
      Test Plan:
      fbconfig -r folly/io/test thrift/lib/cpp2/test && fbmake runtests_opt -j32
      
      Ran unicorn-specific thrift deserialization benchmark from
      D1724070, verified 50% improvement in `SearchRequest` deserialization
      performance.
      
      `thrift/lib/cpp2/test/ProtocolBench` results:
      
      ```
      |---- before -----| |---- after  -----|
      ================================================================================================
      thrift/lib/cpp2/test/ProtocolBench.cpp          relative  time/iter  iters/s  time/iter  iters/s
      ================================================================================================
      BinaryProtocol_read_Empty                                   21.72ns   46.04M    17.58ns   56.89M
      BinaryProtocol_read_SmallInt                                43.03ns   23.24M    23.64ns   42.30M
      BinaryProtocol_read_BigInt                                  43.72ns   22.87M    22.03ns   45.38M
      BinaryProtocol_read_SmallString                             88.57ns   11.29M    47.01ns   21.27M
      BinaryProtocol_read_BigString                              365.76ns    2.73M   323.58ns    3.09M
      BinaryProtocol_read_BigBinary                              207.78ns    4.81M   169.09ns    5.91M
      BinaryProtocol_read_LargeBinary                            187.81ns    5.32M   172.09ns    5.81M
      BinaryProtocol_read_Mixed                                  161.18ns    6.20M    68.41ns   14.62M
      BinaryProtocol_read_SmallListInt                           177.32ns    5.64M    96.91ns   10.32M
      BinaryProtocol_read_BigListInt                              77.03us   12.98K    15.88us   62.97K
      BinaryProtocol_read_BigListMixed                             1.79ms   557.79   923.99us    1.08K
      BinaryProtocol_read_LargeListMixed                         195.01ms     5.13   103.78ms     9.64
      ================================================================================================
      ```
      
      Reviewed By: soren@fb.com
      
      Subscribers: alandau, bmatheny, mshneer, trunkagent, njormrod, folly-diffs@
      
      FB internal diff: D1724111
      
      Tasks: 5770136
      
      Signature: t1:1724111:1417977810:b7d643d0c819a0bbac77fa0048206153929e50a8
      173356a3
    • Sean Cannella's avatar
      Make ThreadLocal identifiers consistent · 2bda6641
      Sean Cannella authored
      Summary:
      Implicitly bouncing between size_t and int for identifiers
      causes problems when building on 64-bit iOS. Fix this.
      
      Test Plan: fbmake runtests
      
      Reviewed By: meyering@fb.com, njormrod@fb.com
      
      Subscribers: trunkagent, njormrod, folly-diffs@, fma, kmdent, shikong, pgriess
      
      FB internal diff: D1722061
      
      Signature: t1:1722061:1417819039:8e3938cf8d4d241551ed3dd3978c1b11f57398c5
      2bda6641
    • Andrii Grynenko's avatar
      Revert "Revert "Make folly::Singleton's destruction happen earlier"" · 96e52d24
      Andrii Grynenko authored
      Summary:
      This reverts commit 7871df125fc1fbe5d8030a41e21b8241b25d4e62.
      
      As explained in t5763478, I don't see good reason for a revert.
      Also the errors under question shouldn't show up after D1720841.
      
      Test Plan: revert-hammer
      
      Reviewed By: stepan@fb.com
      
      Subscribers: njormrod, folly-diffs@
      
      FB internal diff: D1722928
      
      Tasks: 5763478
      
      Signature: t1:1722928:1417818663:1fe402d14c0cf389fb3611355db270c5f2c33738
      96e52d24
    • Hans Fugal's avatar
      More logging in HHWheelTimer::scheduleTimeoutFn · cb3f8bf3
      Hans Fugal authored
      Summary:
      This was supposed to be an update to D1720014 but I screwed up with arc.
      
      Test Plan: run the test by hand and see the output
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: exa, njormrod, folly-diffs@
      
      FB internal diff: D1721951
      
      Signature: t1:1721951:1417801009:72a27ec2ca473a996785ff9cae48bd51a43d9045
      cb3f8bf3
    • Hans Fugal's avatar
      s/makeFuture().via/via/ · bd2552f1
      Hans Fugal authored
      Summary:
      codemod to replace all `makeFuture().via` with just `via`.
      
      Test Plan: contbuild
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: trunkagent, zeus-diffs@, targeting-diff-backend@, abirchall, fugalh, msk, exa, benj, njormrod, folly-diffs@
      
      FB internal diff: D1715876
      
      Signature: t1:1715876:1417712302:b882916d394f90caa23bd73fa68b8f786af649e3
      bd2552f1
    • Hans Fugal's avatar
      via and activate/deactivate chaining · f2ae6aa7
      Hans Fugal authored
      Summary:
      Better support and test chaining of `via` and `activate`/`deactivate`.
      
      The real problem is that without the ref qualifier a multiple chain of lvalue references can end up with a destructed object being referenced after.
      
      https://akrzemi1.wordpress.com/2014/06/02/ref-qualifiers/
      
      Test Plan:
      This is mostly new tests that would fail and now pass.
      I think maybe the tests are a bit weak, it would be good to find a way to ensure we aren't going to see the access-after-free bugs in these tests.
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: trunkagent, fugalh, exa, njormrod, folly-diffs@
      
      FB internal diff: D1714873
      
      Tasks: 5489801
      
      Signature: t1:1714873:1417628538:9e610c5ba5e0a22c19a11d53aa956be45d585058
      f2ae6aa7
    • Hans Fugal's avatar
      Remove Later · a6eb914b
      Hans Fugal authored
      Summary: dalek-exterminate
      
      Test Plan:
      Moved `Later` tests to `via` tests.
      fbgs
      contbuild
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: fbcode-common-diffs@, adityab, lins, trunkagent, fugalh, exa, njormrod, folly-diffs@, hannesr
      
      FB internal diff: D1714862
      
      Tasks: 5409538
      
      Signature: t1:1714862:1417621949:f63f49e1093a021170d2346e8e673db042d2bc56
      a6eb914b
    • Hans Fugal's avatar
      HHWheelTimer::scheduleTimeoutFn · 11329181
      Hans Fugal authored
      Summary:
      cpp11ify
      
      I'm gonna use this for Wangle timeouts.
      
      Test Plan:
      new unit test
      _bin/folly/io/async/test/HHWheelTimerTest
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: trunkagent, exa, njormrod, folly-diffs@
      
      FB internal diff: D1720014
      
      Tasks: 5002969
      
      Signature: t1:1720014:1417732753:ddcad431b6c305c9ba27f6b9e3454ab158c13f4b
      11329181