- 16 Dec, 2012 15 commits
-
-
Tom Jackson authored
Summary: Sometimes it'll be handy to have a custom operator which is little more than the composition of a few base operators. This makes that really easy to do, as shown in examples, tests, and benchmarks. Test Plan: Unit tests, benchmarks Reviewed By: rsagula@fb.com FB internal diff: D617152
-
Tom Jackson authored
Summary: We should be able to print ##Foo*##, even if we can't print ##Foo##. Test Plan: Unit Tests. Reviewed By: tudorb@fb.com FB internal diff: D625977
-
Tom Jackson authored
Summary: If your format string ends up being conditional, it's handy to be able to chain together formatters. Test Plan: Unit tests Reviewed By: tudorb@fb.com FB internal diff: D625502
-
Tudor Bosman authored
Summary: Convert a IOBuf chain into a fbstring, with zero copies in the common case (unshared, unchained, no headroom) and one copy in all other cases. Test Plan: tests added Reviewed By: simpkins@fb.com FB internal diff: D621210
-
Marcelo Juchem authored
Summary: fixing clang errors (used clang 3.1) Test Plan: doh Reviewed By: tudorb@fb.com FB internal diff: D622593
-
Marcelo Juchem authored
Summary: Yes, I admit, I was dumb enough to try it in a benchmark's body. Test Plan: review Reviewed By: tudorb@fb.com FB internal diff: D622613
-
Nicholas Ormrod authored
Summary: DynamicConverter uses some simple heuristics to determine if a class is a container. One of those tests was to check that the constructor 'template <class Iterator> [container-name](Iterator first, Iterator last)' was present. That test was performed by checking if the class could be constructed by two parameters of some dummy class. However, it is possible to restrict the template parameter such that it only accepts iterators, and not any arbitrary dummy class. This would be useful, for example, to solve overload ambiguity with constructors like 'vector(const T& val, size_type n)', where T and size_type are the same (see N3337 23.2.3 item 14). It also (I believe) produces more meaningful compiler errors when a non-iterator is supplied, since it errors at the function callsite instead of inside the constructor itself. The new FBVector implementation uses such a feature, and so checking for [container-name](dummy, dummy) will fail. Hence the dummy class has been upgraded to reverse_iterator<T*>, a valid iterator class which almost certainly does not have a specialized contructor in any class (and hence will not cause any visible change in class_is_container's value). Test Plan: Run DynamicConverterTest; it has tests for the correctness of class_is_container. Reviewed By: delong.j@fb.com FB internal diff: D620607
-
Tudor Bosman authored
Summary: Changed communicate() flags from int to a class. Made Options and CommunicateFlags composable with | Simplified API so you don't have to type Subprocess::Options().stdout(Subprocess::PIPE) Test Plan: subprocess_test Reviewed By: chip@fb.com FB internal diff: D620186
-
Tudor Bosman authored
Test Plan: subprocess_test Reviewed By: delong.j@fb.com FB internal diff: D619713
-
Tudor Bosman authored
Test Plan: subprocess_test Reviewed By: chip@fb.com FB internal diff: D619189
-
Tudor Bosman authored
Summary: Surprised we don't have one. The API is modeled after Python's subprocess module, http://docs.python.org/2/library/subprocess.html Inspired by https://www.facebook.com/groups/fbcode/permalink/445399858830192/, plus I needed this functionality now. Test Plan: test added Reviewed By: chip@fb.com FB internal diff: D614056
-
Misha Shneerson authored
Summary: parseInt128 is only available for GCC 4.7 and above. Test Plan: . Reviewed By: igorzi@fb.com FB internal diff: D618456 Blame Revision: rFBCODEeaec97e2991f
-
Adam Simpkins authored
Summary: Add benchmarks for throwing an exception versus returning std::exception_ptr or other types of return values. Throwing an exception is very expensive. Calling std::make_exception_ptr() without ever throwing is nearly as bad. The exc_ptr_param_return tests were the ones I was most interested in. (Accepting a std::exception_ptr* argument so the caller can indicate if they want to receive an exception or not.) This is fast if the caller doesn't care about the exception value, but very slow if an error occurs and an exception_ptr is required. Test Plan: ====================================================================== folly/test/function_benchmark/main.cpp relative time/iter iters/s ====================================================================== throw_exception 3.90us 256.25K catch_no_exception 1.88ns 533.25M return_exc_ptr 2.79us 357.85K exc_ptr_param_return 2.83us 353.25K exc_ptr_param_return_null 2.25ns 444.38M return_string 69.39ns 14.41M return_string_noexcept 69.39ns 14.41M return_code 1.50ns 666.54M return_code_noexcept 1.50ns 666.54M Reviewed By: rajat@fb.com FB internal diff: D616474
-
Misha Shneerson authored
Summary: Just that. Test Plan: . Reviewed By: igorzi@fb.com FB internal diff: D613291
-
Hari Manikarnika authored
Summary: folly::toJson as demonstrated by the test cases was wrongly encoding utf8 strings. specifically, a utf8 char made up of x bytes was encodeded into x unicode chars. for example, the char: \u2665 which is made of 3 bytes: \xe2\x99\xa5 was encoded correctly when using encode_non_ascii = true: "\u2665" but when encode_non_ascii = false, the json value was wrongly set as: "\u00e2\u0099\u00a5" because we use an signed char that wrongly detects non-readable chars with ascii value > 127 as control chars with ascii value < 32 (\t, \n, etc.) Test Plan: run the test Reviewed By: delong.j@fb.com FB internal diff: D612782
-
- 29 Oct, 2012 8 commits
-
-
Tom Jackson authored
Summary: Tests were run in 'opt', which masked issues alterted by asserts. Test Plan: Unit tests Reviewed By: delong.j@fb.com FB internal diff: D611957
-
Xin Liu authored
Summary: the currently code calls both ~SkipListNode() and node->data_.~value_type() causes double destructing the object. Test Plan: adding dihde's testing code to a test case Reviewed By: emailweixu@fb.com FB internal diff: D612289
-
Marcelo Juchem authored
Summary: fix Benchmark docs Test Plan: read Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D611820
-
Tom Jackson authored
Summary: Moving Comprehensions library into Folly and refactoring its interface to be much more modular and composable. There are now two core abstractions: # Generators: Standalone classes supporting ##apply()## and optionally ##foreach()##. These all inherit from ##GenImpl<T, Self>##. # Operators: Standalone classes which, when composed with a generator, produce a new generator. These all inherit from ##OperatorImpl<Self>##. These generators may be composed with ##operator|## overloads which only match ##const GenImpl<T, Self>&## on the left like ##gen | op##. Additionally, generator may be consumed inline with ##gen | lambda## like ##gen | [](int x) { cout << x << endl; };##. With this design, new operators may be added very simply without modifying the core library and templates are instantiated only exactly as needed. Example: ```lang=cpp auto sum = seq(1, 10) | filter(isPrime) | sum; seq(1, 10) | [](int i) { cout << i << endl; }; ``` Test Plan: Unit tests Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D542215
-
Andrei Alexandrescu authored
Summary: C++11 added front() and back() that return by reference. fbstring also added front() and back() as non-standard convenience functions, which returned by value. This diff aligns fbstring with the standard. Test Plan: added and ran unittest Reviewed By: delong.j@fb.com FB internal diff: D607574
-
Tom Jackson authored
Summary: Optional, like boost::optional, but with full rvalue support. Test Plan: Unit tests Reviewed By: delong.j@fb.com FB internal diff: D571810
-
Tudor Bosman authored
Summary: For std::exception_ptr. Test Plan: . Reviewed By: davejwatson@fb.com FB internal diff: D600345
-
Sumeet Ungratwar authored
Summary: Understood how traits are implemented in folly/Traits.h and added examples on how to use them. Test Plan: no specific tests Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D546631
-
- 12 Oct, 2012 14 commits
-
-
Tudor Bosman authored
Summary: SpookyHashV2 is backwards incompatible with V1. I renamed the existing SpookyHash class to SpookyHashV1 (and fixed all uses); the new class is called SpookyHashV2. From http://burtleburtle.net/bob/hash/spooky.html: Both V1 and V2 pass all the tests. V2 corrects two oversights in V1: In the short hash, there was a d = length that should have been d += length, which means some entropy got dropped on the floor. It passed the tests anyhow, but fixing this probably means more distinct info from the message makes it into the result. The long hash always ended in mix()+end(), but only end() was needed. Removing the extra call to mix() makes all long hashes faster by a small constant amount. Test Plan: test added; unicorn compiles Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D597173
-
Wei Xu authored
Summary: '\0' may actually be part of string. We cannot assume its null terminated and should use another form of fnv32. Test Plan: FBStringTest Reviewed By: xliux@fb.com FB internal diff: D595287
-
Rajat Goel authored
Summary: It seems it is not std::bind which is slow but the construction of std::function from std::bind that is slow. Test Plan: ran benchmarks Reviewed By: delong.j@fb.com FB internal diff: D581967
-
Jonathan Coens authored
Summary: The Arena allocator knows how much memory it's using up, so create a function that allows clients to figure out how much it's using. Also create a unit test to sanity check this stuff. Test Plan: folly/test/ArenaTest.cpp Reviewed By: tudorb@fb.com FB internal diff: D579399
-
Anton Likhtarov authored
Summary: Background: we want to use folly::json but not change the way data is represented. Since we need to store \r and \n in strings and the library we're currently using does this, let's do it in folly too. Test Plan: unit tests pass Reviewed By: delong.j@fb.com FB internal diff: D584960
-
Ashoat Tevosyan authored
Summary: These are necessary for string-keyed maps, since maps const their keys. Test Plan: I wrote a test. Reviewed By: njormrod@fb.com FB internal diff: D582283
-
Andrew Tulloch authored
Summary: Fixed escaping bug where the `>` in `operator->` was interpreted as starting a code block. Folly github pull #15. Test Plan: no Reviewed By: njormrod@fb.com FB internal diff: D582873
-
Jordan DeLong authored
Summary: After a conversation with njormrod I remembered why we didn't do this. Let's document it. Test Plan: It's docs. Reviewed By: njormrod@fb.com FB internal diff: D582651
-
Philip Pronin authored
Summary: Array of spinlocks where each one is padded to prevent false sharing. Useful for shard-based locking implementations in environments where contention is unlikely. Test Plan: ran tests in 'common' Reviewed By: soren@fb.com FB internal diff: D582149
-
Andrei Alexandrescu authored
Summary: In https://phabricator.fb.com/D511928 Brian mentioned the current API for string append is insufficient for appending to a buffer. That made me curious about the relative performance of classic and table-based number to ASCII conversions. The results were interesting as on the average (over all digit lengths) the table-based conversion was faster, but performance was lackluster (in the worst case half as fast as the classic implementation) for large numbers, I presume due to the cache misses incurred by the tables. This diff proposes an improved unsigned-to-ASCII primitive that is much faster than both table-based (previous Folly) and classic primitive. The key is a fast digits10() implementation that precomputes the space required by the conversion. After that, the digits are issued in place, no more reverse required. The new routine is up to 14x faster than the classic implementation, depending on the number of digits (benchmarks in comments). Adding a few people who may be interested in the matter. Brian, thanks for bringing this matter up; if this gets in you may want to use the folly routine in proxygen. Test Plan: unittest and benchmarks. Reviewed By: simpkins@fb.com FB internal diff: D515572
-
Jeremy Lilley authored
Summary: The following asserts: fbstring str(1337, 'f'); fbstring cp = str; cp.push_back('f'); This is problematic since ml_.capacity() != capacity() inside fbstring_core for shared strings, which causes us not to un-share prior to push_back. Test Plan: Existing tests, add unittest case. Reviewed By: tudorb@fb.com FB internal diff: D580267
-
Lucian Grijincu authored
Summary: implement ##find_first_of## and optimize ##Range.find(char)## ============================================================================ folly/test/RangeBenchmark.cpp relative time/iter iters/s ============================================================================ LongFindSingleCharDirect 2.76ms 362.63 LongFindSingleCharRange 15.88% 17.37ms 57.58 ShortFindSingleCharDirect 53.41fs 18.72T ShortFindSingleCharRange 0.00% 29.22ns 34.22M ============================================================================ Test Plan: - added new tests - ran all folly tests fbconfig -r folly/ && mkk runtests_opt Reviewed By: tudorb@fb.com FB internal diff: D576720
-
Rajat Goel authored
Summary: This makes code easy to read for eyes used to unique/shared ptrs. Test Plan: unit-tests Reviewed By: delong.j@fb.com FB internal diff: D575997
-
John Fremlin VII authored
Summary: Add a pop_back() function to dynamic arrays. Test Plan: - used it Reviewed By: delong.j@fb.com FB internal diff: D569440
-
- 17 Sep, 2012 3 commits
-
-
Anton Likhtarov authored
Summary: Couldn't get an HPHP extension to compile against this Test Plan: compiled HPHP including folly/dynamic.h Reviewed By: delong.j@fb.com FB internal diff: D574364
-
Tudor Bosman authored
Test Plan: by hand Reviewed By: philipp@fb.com FB internal diff: D570233
-
Fan Guo authored
Summary: Folly supports -inf and nan but not -nan, instead it raised unexpected exceptions not handled in the upstream. This diff is separated out from D569816 -- Diff1. Test Plan: std::isnan(folly::to<double>(-nan)) Reviewed By: tudorb@fb.com FB internal diff: D569939
-