- 27 Mar, 2013 6 commits
-
-
Owen Yamauchi authored
Summary: Compile out instead of erroring. In an ideal world, we'd have a fallback that would work across platforms (i.e. no SSE, no unaligned 32-bit writes etc.) and compile some version of GroupVarint in all environments. I actually tried this; the SSE stuff is all behind #if __SSSE3__ already, so I thought it could work (modulo the unaligned-writes problem). I ran into problems with the SSSE3-vs.-not distinction that @simpkins alluded to in D652764, and decided I'd rather not open that can of worms at the moment. Test Plan: fbmake runtests. Manually force the #ifs to false and make sure fbmake runtests still passes (although GroupVarintTest is empty). Reviewed By: delong.j@fb.com FB internal diff: D747150
-
Louis Brandy authored
Summary: Go with the fat header approach. Merge these two into Memory.h. We could, potentially, include Malloc.h as well, but it fbstring header uses the once define for some special magic. Leave it alone for now. An alternate approach might be moving all three leaner headers into a `memory/` subdir with `folly/Memory.h` just #including the three. Test Plan: fbconfig folly/tests && fbmake runtests_opt Reviewed By: delong.j@fb.com FB internal diff: D745873
-
Mike Curtiss authored
Summary: Certain operations should not be performed on infinite sequences (e.g. sorting, left-folds, summation). In some cases, we can detect that a sequence is infinite at compile-time and provide a static_assert to prevent such dangerous operations. Test Plan: Manually created cases where the operation should be disallowed. Compiler correctly raised an error. Reviewed By: tjackson@fb.com FB internal diff: D740011
-
Louis Brandy authored
Summary: See title. Test Plan: Inspection. Reviewed By: delong.j@fb.com FB internal diff: D745883
-
Hans Fugal authored
Summary: Generate an `fbvector` of `struct iovec` suitable for using with `writev` or `sendmsg`. This code is pretty straightforward, but Adam pointed out that something along these lines has already been done in thrift, so I followed that code closely. http://fburl.com/11586814 Test Plan: fbmake runtests I am using also this in a prototype and it's working there. Reviewed By: agartrell@fb.com FB internal diff: D744055
-
Alessandro Salvatori authored
Summary: allow to dequeue the first IOBuf in an IOBufQueue Test Plan: throughly tested with some dependent code in proxygen Reviewed By: tudorb@fb.com FB internal diff: D732484
-
- 19 Mar, 2013 34 commits
-
-
Mike Curtiss authored
Summary: Aligned loads are faster on some architectures. Let's refactor qfind_first_of so that it uses aligned loads when possible. Also modify the benchmarks to account for begin/end-of-string logic. Test Plan: Tests pass. Updated benchmarks. Generally seeing a 5-20% speed-up, depending on the situation. Reviewed By: philipp@fb.com FB internal diff: D720369
-
Tom Jackson authored
Summary: We don't do this today, but it looks like std::string does. For longer, similar strings, this is a big win. Before: ```lang=text ============================================================================ ./folly/test/FBStringTestBenchmarks.cpp.h relative time/iter iters/s ============================================================================ BM_equality_string(65536) 5.13ms 194.87 BM_equality_fbstring(65536) 11.34ms 88.18 ============================================================================ ``` After: ```lang=text ============================================================================ ./folly/test/FBStringTestBenchmarks.cpp.h relative time/iter iters/s ============================================================================ BM_equality_string(65536) 5.01ms 199.74 BM_equality_fbstring(65536) 6.63ms 150.78 ============================================================================ ``` Test Plan: Benchmark, unit tests Reviewed By: tudorb@fb.com FB internal diff: D737482
-
Tom Jackson authored
Summary: Otherwise you get errors like `error: array used as initializer ./folly/experimental/StringGen-inl.h: In constructor ‘folly::gen::detail::UnsplitBuffer<Delimiter, OutputBuffer>::UnsplitBuffer(const Delimiter&, OutputBuffer*) [with Delimiter = char [3] ...]`, since literal strings bind as reference to fixed-length character arrays. Providing an explicit overload for `const char*` fixes this. Test Plan: Unit tests Reviewed By: tulloch@fb.com FB internal diff: D737117
-
Marcelo Juchem authored
Summary: template <typename SomeInt> void foo(SomeInt x) { // yields an error in clang when SomeInt is unsigned and -Werror is used if(x <= 0) { //... } } Test Plan: added unit tests Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D735735
-
David Vickrey authored
Summary: std::hash is not awesome and not configurable. Typical cases you might want to customize are: string: I happen to know that fnv isn't super awesome, for example, and that's what folly uses for std::hash fbstring. pointers: you may want to hash the contents of the pointer instead of the address for certain types. This is a very simple diff that lets you do that. It provides StdHasher that passes through to std::hash and uses that for hash_combine, so this should be 100% backward compatible. Test Plan: test_hash. I will add another test for using a hasher besides StdHasher shortly. Reviewed By: delong.j@fb.com FB internal diff: D733899
-
Tom Jackson authored
Summary: GENERATOR was broken if you didn't `using namespace folly::gen`, and we're still copying quite a few functors where we could move them. Test Plan: Unit tests Reviewed By: chaoyc@fb.com FB internal diff: D731253
-
Lovro Puzar authored
Summary: See new test. Under GCC 4.6 (which is what the folly tests build with) the old code works fine but under 4.7 building fails with: folly/test/OptionalTest.cpp: In member function ‘virtual void Optional_AssignmentContained_Test::TestBody()’: folly/test/OptionalTest.cpp:122:14: error: use of deleted function ‘ContainsOptional& ContainsOptional::operator=(const ContainsOptional&)’ folly/test/OptionalTest.cpp:106:21: note: ‘ContainsOptional& ContainsOptional::operator=(const ContainsOptional&)’ is implicitly deleted because the default definition would be ill-formed: folly/test/OptionalTest.cpp:106:21: error: use of deleted function ‘folly::Optional<int>& folly::Optional<int>::operator=(const folly::Optional<int>&)’ In file included from folly/test/OptionalTest.cpp:17:0: ./folly/Optional.h:84:7: note: ‘folly::Optional<int>& folly::Optional<int>::operator=(const folly::Optional<int>&)’ is implicitly declared as deleted because ‘folly::Optional<int>’ declares a move constructor or move assignment operator folly/test/OptionalTest.cpp:129:30: error: use of deleted function ‘ContainsOptional& ContainsOptional::operator=(ContainsOptional&&)’ folly/test/OptionalTest.cpp:108:21: note: ‘ContainsOptional& ContainsOptional::operator=(ContainsOptional&&)’ is implicitly deleted because the default definition would be ill-formed: folly/test/OptionalTest.cpp:108:21: error: non-static data member ‘ContainsOptional::opt_’ does not have a move assignment operator or trivial copy assignment operator folly/test/OptionalTest.cpp:137:14: error: use of deleted function ‘ContainsOptional& ContainsOptional::operator=(const ContainsOptional&)’ Test Plan: (1) fbconfig folly/test && fbmake dbg && _build/dbg/folly/test/optional_test (2) Remove folly/PLATFORM to build with gcc 4.7, then repeat (1). Without the code fix, the new test fails to build. With the fix, the test builds and runs fine. Reviewed By: tjackson@fb.com FB internal diff: D732402
-
Ben Gertzfield authored
Summary: When compiling folly with clang, the compiler warns about our use of GCC-specific pragmas to silence incorrect compiler warnings: folly/Optional.h:79:33: warning: unknown warning group '-Wpragmas', ignored [-Wunknown-pragmas] folly/Optional.h:80:33: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-pragmas] Thankfully, those incorrect compiler warnings are not emitted by clang, so we can just disable the pragmas in clang. Test Plan: Built folly in gcc and ran it through clang. Warning above is gone. Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D733323
-
Tudor Bosman authored
Test Plan: async_io_test Reviewed By: philipp@fb.com FB internal diff: D730100
-
Tom Jackson authored
Summary: In hopes of keeping 'busywork' helpers out of folly, I've moved this closer to the code that needed to do this. Test Plan: Unit tests Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D729194 Blame Revision: D726916
-
Tom Jackson authored
Summary: Now that we have truthy files, it would be nice to be able to simply //try// opening files and return a possibly-initialized File. Test Plan: Unit tests Reviewed By: chaoyc@fb.com FB internal diff: D726916
-
Tom Jackson authored
Summary: File has a default constructor so it can be initialized late, but it doesn't have a good canonical way to see if it's been initialized. This adds an //explicit// operator bool so you can test files like `if (file) ...`. Test Plan: Unit tests Reviewed By: chaoyc@fb.com FB internal diff: D726914
-
Tudor Bosman authored
Summary: Added Adaptor(size_t, const value_type&) Test Plan: test added Reviewed By: soren@fb.com FB internal diff: D726358
-
Tom Jackson authored
Summary: 'open() failed' isn't too helpful. Seeing a filename there is. So I added it. Test Plan: Unit test Reviewed By: mohittalwar@fb.com FB internal diff: D725204
-
Adam Simpkins authored
Summary: Add a --bm_min_iters flag to control the minimum number of iterations that the benchmark code starts with on each epoch. This can be used on benchmarks that test very cheap operations, but take a long time to set up. Otherwise the benchmark code may have to retry many times before it hits a large enough number of iterations to get a meaningful result, and each time it still pays the fixed setup cost. This also helps with benchmarks when some of the setup cost cannot be hidden with BenchmarkSuspender for some reason. --bm_min_iters can be set to a large enough value so that the extra startup cost will not affect the measurements too much. Test Plan: Used this with the thread local stats benchmark. During setup/cleanup, this benchmark starts and synchronizes with many threads. The entire setup time cannot be reliably hidden with BenchmarkSuspender; the synchronization between the threads takes a relatively long time compared to the cost of the operation being benchmarked. --bm_min_iters allows a relatively high number of iterations to be used, masking this cost. Reviewed By: rajat@fb.com FB internal diff: D723304
-
Mike Curtiss authored
Summary: Helper method for creating a folly::Optional<T> by just passing in a T reference. Analogous to boost::make_optional. Test Plan: Added test case Reviewed By: tjackson@fb.com FB internal diff: D721762
-
Lucian Grijincu authored
Summary: MemoryMapping::data() returns StringPiece ::range() returns ByteRange Test Plan: tests Reviewed By: philipp@fb.com FB internal diff: D720985
-
Owen Yamauchi authored
Summary: There are platforms other than clang that don't support ifuncs. (The one I'm concerned about is ARM.) I changed the ifdef __clang__ around the ifunc attributes to be more abstract, so we can can pass in this flag on the command line, or use autoconf to detect it. Test Plan: fbmake runtests. Manually define HAVE_IFUNC 0 and make sure the popcount() and popcountll() functions get compiled as calls to popcount_builtin. Run autoreconf, ./configure, make sure the feature gets detected properly by looking at config.h. Reviewed By: andrewjcg@fb.com FB internal diff: D712192
-
Tom Jackson authored
Summary: This flag conflicts with the flag with the same purpose in `common/files/MemoryMappedFile.cpp`. Just renaming it for now. Test Plan: Build Reviewed By: lucian@fb.com FB internal diff: D717067
-
Tom Jackson authored
Summary: MemoryMapping is a C++ wrapper object around mmap. It works with `folly::File`s, and provides bitwise-range access for reading and writing files. Test Plan: Unit test Reviewed By: lucian@fb.com FB internal diff: D452384
-
Lucian Grijincu authored
Summary: Change State to enum class, and add debugging helper to AsyncIOOp and AsyncIO. Test Plan: n/a Reviewed By: philipp@fb.com FB internal diff: D715676
-
Tom Jackson authored
Summary: Moving File into `/folly`. Test Plan: Same unit tests, rebuild affected code outside folly. Reviewed By: philipp@fb.com FB internal diff: D714462
-
Mike Curtiss authored
Summary: Our SSE version of find_first_of was reading past the end of the StringPiece in some cases, which (very rarely) caused a seg-fault when we were reading outside of our allotted virtual address space. Modify the code to never read past the end of the underlying buffers except when we think it's "safe" because we're still within the same page. (ASSUMPTION: if a process is allowed to read a byte within a page, then it is allowed to read _all_ bytes within that page.) Test Plan: Added tests that verify we won't go across page boundaries. Sadly, this code hurts our benchmarks -- sometimes by up to 50% for smaller strings. Reviewed By: philipp@fb.com FB internal diff: D707923 Blame Revision: D638500
-
Tudor Bosman authored
Summary: AsyncIOOp no longer requires derivation to be able to use callbacks; the callback is passed in. This makes composition easier (see AsyncIOQueue, added in this diff). Test Plan: async_io_test, test added Reviewed By: lucian@fb.com FB internal diff: D709648
-
Tudor Bosman authored
Test Plan: No Reviewed By: philipp@fb.com FB internal diff: D709795
-
Rajat Goel authored
Summary: Compilation is failing in 'opt' build Test Plan: compile Reviewed By: andrewjcg@fb.com FB internal diff: D707869
-
Tudor Bosman authored
Test Plan: No Reviewed By: philipp@fb.com FB internal diff: D707792
-
Gaurav Jain authored
Summary: Minor clang compiler fixes Test Plan: - fbmake runtest Reviewed By: andrewjcg@fb.com FB internal diff: D707663
-
Sergey Doroshenko authored
Summary: It is set once, and is never changed afterwards. Test Plan: compiled, unit tests Reviewed By: tudorb@fb.com FB internal diff: D706125
-
Jordan DeLong authored
Summary: codemod with 'Yes to all'. Test Plan: None really. Reviewed By: abirchall@fb.com FB internal diff: D693769
-
Tudor Bosman authored
Test Plan: folly/io/test, both dbg and opt, standalone and in valgrind Reviewed By: philipp@fb.com FB internal diff: D702755
-
Tom Jackson authored
Summary: TSIA Test Plan: Unit tests Reviewed By: tulloch@fb.com FB internal diff: D701890
-
Tudor Bosman authored
Test Plan: async_io_test Reviewed By: lucian@fb.com FB internal diff: D699175
-
Peter Griess authored
Summary: - Add CursorBase::operator-() implementations for Cursor and BufType; useful for figuring out the distance between two objects Test Plan: - Used in some other code Reviewed By: simpkins@fb.com FB internal diff: D690046
-