- 16 Dec, 2012 40 commits
-
-
Nicholas Ormrod authored
Summary: Added IsBits (has value semantics; can be copied by memcpy and deleted by free. Implies IsRelocatable) and Is0Initializable (new (ptr) T() is equivalent to memset(ptr, 0, sizeof(T))). Converted the boost types for IsRelocatable to std types (now available from <type_traits>). Added a new way to specify IsRelocatable, IsBits, and Is0Initializable: typedef std::true_type <property-name> in your class. No namespace exiting required. This method also supports inheritance, and may be overriden in base classes. Added a test file to test Traits. Test Plan: Run new test file. Compile some real-world code (in my case, multifeed). Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D610996
-
Tom Jackson authored
Summary: I forgot fbmake runtests doesn't build all that's configured, oops. Test Plan: Build folly/experimental/test, run benchmark. Reviewed By: tudorb@fb.com FB internal diff: D647191
-
Philip Pronin authored
Summary: It makes sense to return subpiece of the original data from ##rest()##. Test Plan: gv tests Reviewed By: soren@fb.com FB internal diff: D647179
-
Tom Jackson authored
Summary: It was previously breaking any time a generator included a comma, which is pretty stupid. Now, it's modelled after `ScopeGuard`, using a little operator overloading to get rid of the trailing `)` and sidestepping preprocessor issues. Test Plan: Unit tests Reviewed By: tudorb@fb.com FB internal diff: D646825
-
Tudor Bosman authored
Summary: Code that aids in storing data aligned on block (possibly cache-line) boundaries, perhaps with padding. There's class Node which represents one block, and Iterator which, given an iterator to a container of Nodes, gives you an iterator to the underlying elements. There's also Adaptor, which converts a sequence of Node into a sequence of underlying elements. (with enough functionality to make it useful, although it's not fully STL compatible) Split off from https://phabricator.fb.com/D641114 Also includes changes to make TypedIOBuf container-like so it can be used with padded_sequence::Adaptor. I plan to rename this to Padded.h / folly::padded in a separate diff. Test Plan: test added Reviewed By: soren@fb.com FB internal diff: D646249
-
Soren Lassen authored
Summary: I noticed that push_back(Char) was slower for fbstring than for std::string for long strings and found that I could make it faster by inlining the call to mutable_data() and exploit that it's always non-small and non-shared. Benchmarks before: ./folly/test/FBStringTestBenchmarks.cpp.h relative time/iter iters/s BM_push_back_string(1) 69.42ns 14.41M BM_push_back_string(23) 582.31ns 1.72M BM_push_back_string(127) 1.47us 682.12K BM_push_back_string(1024) 5.52us 181.07K BM_push_back_fbstring(1) 9.55ns 104.74M BM_push_back_fbstring(23) 212.45ns 4.71M BM_push_back_fbstring(127) 864.00ns 1.16M BM_push_back_fbstring(1024) 6.73us 148.52K and after: BM_push_back_fbstring(1) 9.55ns 104.74M BM_push_back_fbstring(23) 212.45ns 4.71M BM_push_back_fbstring(127) 783.08ns 1.28M BM_push_back_fbstring(1024) 4.03us 248.05K Test Plan: fbconfig folly/test && fbmake runtests Reviewed By: tudorb@fb.com FB internal diff: D646081
-
Helios Alonso Cabanillas authored
Summary: Added closing curly braces at 173. Sorry, must make diff if it's a new commit. Test Plan: nothing really Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D644925
-
Helios Alonso Cabanillas authored
Summary: Added two samples of use for FBVector in docs Test Plan: just check if FBVector.md looks good. Reviewed By: njormrod@fb.com FB internal diff: D636813
-
Yiding Jia authored
Summary: This code is not strictly correct per c++ spec section 14.2.4: > When the name of a member template specialization appears after . or -> in a > postfix-expression or after a nested-name-specifier in a qualified-id, and the > object or pointer expression of the postfix-expression or the > nested-name-specifier in the qualified-id depends on a template parameter > (14.6.2) but does not refer to a member of the current instantiation > (14.6.2.1), the member template name must be prefixed by the keyword template. > Otherwise the name is assumed to name a non-template. This causes clang to complain, but gcc is lax about this, as usual. Test Plan: compile stuff that use this. Reviewed By: delong.j@fb.com FB internal diff: D643515
-
Yiding Jia authored
Summary: the old code is ill-formed per spec (section 14.6.8): > If a type used in a non-dependent name is incomplete at the point at which a > template is defined but is complete at the point at which an instantiation is > done, and if the completeness of that type affects whether or not the program > is well-formed or affects the semantics of the program, the program is > ill-formed; no diagnostic is required. GCC is lax and allows this, clang gives an error. Test Plan: compiles. Reviewed By: delong.j@fb.com FB internal diff: D643431
-
Yiding Jia authored
Summary: curiously, std::out_of_range doesn't have a zero-argument constructor according to the spec. This was causing issues in my clang setup... Test Plan: compiles. Reviewed By: delong.j@fb.com FB internal diff: D643363
-
Tudor Bosman authored
Test Plan: looked at the generated html in a browser Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D642998
-
Davide Bolcioni authored
Summary: Added specializations of folly::to<String> for __int128_t and __uint128_t. Test Plan: Added tests of the above to the integral to string tests. Reviewed By: andrei.alexandrescu@fb.com FB internal diff: D636992
-
Sergey Doroshenko authored
Summary: Returns number of bytes "really used by the user", i.e. number of bytes allocated on the arena via calls to `allocate()`. Test Plan: compiled, unit tests Reviewed By: azzolini@fb.com FB internal diff: D636976
-
Tom Jackson authored
Summary: Supressing the warning for GCC4.7, and supressing the error supressing the warning in GCC4.6. Test Plan: Compile, run unit tests on GCC4.6 and GCC4.7 Reviewed By: ldbrandy@fb.com FB internal diff: D635982
-
Soren Lassen authored
Summary: Noticed these TODOs in Conv.h and decided to fix them. Discovered that the underlying_type implementation also covers enum classes, which didn't work with the pre-existing code. Test Plan: fbconfig -r folly --platform=gcc-4.7.1-glibc-2.14.1-fb fbmake dbg _bin/folly/test/conv_test _bin/folly/test/conv_test --platform=gcc-4.6.2-glibc-2.13 fbmake dbg _bin/folly/test/conv_test _bin/folly/test/conv_test Reviewed By: tudorb@fb.com FB internal diff: D634309
-
Alan Frindell authored
Summary: D633912 broke unicorn because it relied on preallocate having a hard max. Add an optional hard max parameter and rename maxHint to newAllocationSize. Pass the hard max in for unicorn Test Plan: folly and unicorn unit tests Reviewed By: tudorb@fb.com FB internal diff: D634894
-
Alan Frindell authored
Summary: IOBufQueue::preallocate currently takes a min and max size, and will return to the caller a buffer with N writable bytes with min <= N <= max. This is a bit wasteful, since there may be more than max bytes available at the end if the queue with no extra cost. Now preallocate will return the full amount of contigious space to the caller, even if it is larger than the requested max. Test Plan: folly and proxygen unit tests Reviewed By: simpkins@fb.com FB internal diff: D633912
-
Dave Watson authored
Summary: cursor.clone() will clone a length of the chain. insert(std::move(buf)) will splice in a length of chain I want this to change thrift2 binary type to IOBuf: we will clone() the network data for zero-copy userspace data, and insert() it if the return value is a IOBuf. Test Plan: added unittest Reviewed By: afrind@fb.com FB internal diff: D632073
-
Adam Simpkins authored
Summary: Add a version of IOBuf::copyBuffer() which accepts a std::string, as well as a maybeCopyBuffer() function which returns a null pointer if the input string is empty. In proxygen we have a few places where we construct an IOBuf from a string configuration parameter, and we almost always want a null pointer rather than an empty IOBuf chain if the string is empty. Test Plan: Included unit tests for these new functions. Reviewed By: tudorb@fb.com FB internal diff: D630547
-
Tom Jackson authored
Summary: ##byLine## already yields StringPieces, no neat to ##eachAs()## then. Test Plan: fbconfig folly/experimental/symbolizer folly/test folly/experimental/io folly/experimental/io/test tupperware/agent fbmake opt Reviewed By: tudorb@fb.com FB internal diff: D630422
-
Tudor Bosman authored
Test Plan: build Reviewed By: dneiter@fb.com FB internal diff: D630324
-
Tudor Bosman authored
Test Plan: build Reviewed By: tjackson@fb.com FB internal diff: D630280
-
Tudor Bosman authored
Test Plan: test added Reviewed By: tjackson@fb.com FB internal diff: D630163
-
Tudor Bosman authored
Test Plan: build Reviewed By: tjackson@fb.com FB internal diff: D630266
-
Tudor Bosman authored
Summary: Switch existing code to gen::byLine. Also fix namespaces in folly/experimental/(symbolizer|exception_tracer). Test Plan: fbconfig -r folly && fbmake runtests_opt, ran non-test folly binaries by hand, fbgs for other uses (there aren't any) Reviewed By: tjackson@fb.com FB internal diff: D629576
-
Tom Jackson authored
Summary: Normal split to complement resplit, and it's a bit faster than folly::split(). Test Plan: Unit tests, Benchmarks (result in code comment) Reviewed By: tudorb@fb.com FB internal diff: D629998
-
Tudor Bosman authored
Test Plan: no Reviewed By: tjackson@fb.com FB internal diff: D629502
-
Tudor Bosman authored
Summary: Also added eachAs (cast each value as a given type) and eachTo (use folly::to on each value) Test Plan: test added Reviewed By: tjackson@fb.com FB internal diff: D628868
-
Tudor Bosman authored
Summary: Make things work with non-copyable generators. Test Plan: folly/experimental/test Reviewed By: tjackson@fb.com FB internal diff: D628520
-
Philip Pronin authored
Summary: Want to be able to call them from other constexpr functions and from within static_assert()s. Test Plan: compiled and ran folly tests Reviewed By: tudorb@fb.com FB internal diff: D627413
-
Chao Yang authored
Summary: That's all. Test Plan: . Reviewed By: tjackson@fb.com FB internal diff: D618824
-
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
-