11 ms·
Folly – Faceboook’s open source C++ library
- kroltan 7y agoI found the README is not particularly useful in informing what the library does, but it seems to be a big bag of data structures, algorithms, and performance utilities. The overview is much more informative: https://github.com/facebook/folly/blob/master/folly/docs/Overview.md https://github.com/facebook/folly/blob/master/folly/docs/Ove...
- wanderingstan 7y agoIts amazing how often READMEs fail to describe what a repo actually does! I suspect that this information seems so obvious to the maintainers that it gets overlooked. But its frustrating when a repo looks like it might be what I need but all I can find are installation instructions.
- hortense 7y ago"folly requires gcc" That's surprising to me. Clang and the associated tools are so useful I would have expected all tech companies to have migrated to it.
- Cthulhu_ 7y agoI could be wrong, but, a quick Googling / wiki shows clang is from 2007, whilst facebook was founded 2004, and even though clang was available in 2007, it takes years before people consider using newer tools like clang over proven technology, especially in the C space.
- swiftcoder 7y agoI'm pretty sure that "folly requires gcc 5.1+" is meant to be a statement about the minimum GCC version, and not that GCC is the only compiler that will work. If you poke around the github issues, you'll note that several folks are successfully compiling folly with Clang.
- m463 7y agoIt seems like a pretty mature cross-platform library. It could be their statement "folly requires gcc 5.1+" meant gcc 5.1 or greater, where clang might be greater?
- msla 7y ago> It could be their statement "folly requires gcc 5.1+" meant gcc 5.1 or greater, where clang might be greater? Reminds me of an old joke: "The package said it required Windows 95 or better, so I installed Linux." They'd save a lot of guessing by putting in which Special Modern Features their code relies on.
- jesboat 7y ago> They'd save a lot of guessing by putting in which Special Modern Features their code relies on. The first paragraph of the readme starts with "Folly (acronymed loosely after Facebook Open Source Library) is a library of C++14 components" and gcc 5.1 is the first version (https://gcc.gnu.org/projects/cxx-status.html#cxx14 https://gcc.gnu.org/projects/cxx-status.html#cxx14) which supports all of c++14
- foobar502 7y agoCould you elaborate on that? What aspects of using clang as opposed to gcc were so beneficial?
- pdpi 7y agoThe sanitisers are a good reason (UBSan, ASan). Clang compilation is faster than GCC, also. Don't know if it's still true, but when I was at Facebook we used Clang for debug builds, and GCC for production builds.
- andrewflnr 7y agoIs it just me or is that a recipe for Heisenbugs?
- btian 7y agoBetter error messages
- Jyaif 7y agoI'm talking about the sanitizers, clang-tidy, clang-format, and of course the error messages of clang itself.
- yfeldblum 7y agoThe highlighted sentence gives the minimum version of gcc which folly broadly supports. One motivation for this is so that a user may know whether folly supports the version of the gcc c++ compiler which is preinstalled on their system, since many systems ship with a preinstalled gcc. Likewise for systems which ship with a blessed package repo. But folly also supports recent versions of clang and msvc, as other commenters here note.
- jesboat 7y agoDon't know why people downvoted you. The intended interpretation was "if gcc, must be 5.1+", but I can see how it might be misunderstood as it was written. The readme was updated and now reads > folly supports gcc (5.1+), clang, or MSVC. It should run on Linux (x86-32, x86-64, and ARM), iOS, macOS, and Windows (x86-64). The CMake build is only tested on some of these platforms; at a minimum, we aim to support macOS and Linux (on the latest Ubuntu LTS release or newer.) folly is used in FB opensource projects on Windows, macOS, and Linux (e.g. watchman) and Android and iOS (React Native, though that might not include the whole library.)
- zelphirkalt 7y agoWhat a folly!
- antoineMoPa 7y agoInteresting how any company with enough C++ developers will eventually develop a huge library like that (with data structures and tools and system wrappers). In the JS ecosystem, we may complain that node_modules is large, but at least we are not reimplementing and rewrapping the wheel at every corp (same for python). Maybe if C++ had a standard package manager, people would stop coding huge libraries like that, focusing on smaller libraries that can be reused (independently).
- jakearmitage 7y agoIf you're using C++, you want speed and/or memory efficiency. Generic libraries won't give you that. You need custom implementations of data structures that make the trade-offs relevant to your needs.
- antoineMoPa 7y agoThere is no reason for memory or speed to be different. What I mean is that parts of these libraries could be single small packages that would be as fast. As an example, look at this folder which: https://github.com/facebook/folly/tree/master/folly/compression https://github.com/facebook/folly/tree/master/folly/compress... In short, these are compression tools. Why not have 1 easily uninstallable package per compression tool in a standard package manager that works the same on all platforms. Things don't have to be more or less generic.
- Eyas 7y agoSo the comment is really about the size of these libraries? This is more of an artifact of companies that produced them, which use large monorepos, than the ecosystem itself. That said, you can pick and choose which part of boost you use, just as you can pick and choose which part of Abseil/Folly you use.
- forrestthewoods 7y ago> Why not have 1 easily uninstallable package per compression tool in a standard package manager that works the same on all platforms. Because C++ sucks and its dependency story is a nightmare. There are a few competing C++ package managers. They’re all relatively new and none of them are particularly popular. The most widespread C++ libraries are ones that are single header files. Because that’s the only thing that’s trivial to implement into an existing project. Compiling OpenSSL requires installing Strawberry Perl. This type of garbage of BS is the norm. Source: C++ dev for 15 years
- notacoward 7y agoI get to see a lot of folly code, since I'm at Facebook. It's mostly improved implementations and semi-obvious extensions of things that already exist in the C++ standard library, plus prototypes of things that will be in the next standard. Much like boost. While this is mostly good, it has to be said that improved implementations of bad patterns from the C++ standard (especially around concurrent programming) aren't something I'd spend my own time on. Life's too short to invent a better square wheel.
- sriram_sun 7y agoI don't want to end up splitting hairs over terminology so please correct me if I'm wrong. I would like expect a c++ library (folly or the standard library) to provide concurrency primitives and not patterns. Once you start providing patterns you are wading into framework territory. Is that the case with folly?
- hellofunk 7y agoThe C++ standard has included threading primitives since 2011. Many libraries exist that create higher level of abstractions, i.e. patterns, on top of these primitives. But you can also just use the primitive directly.
- notacoward 7y agoUnfortunately yes. The whole way that futures and "EventBase" are tangled up makes them more of a framework (and not one I would use if I had a choice) than a set of primitives. https://github.com/facebook/folly/tree/master/folly/io/async https://github.com/facebook/folly/tree/master/folly/io/async
- sriram_sun 7y agoThanks! I was going to ask "Does folly have its own asyncio for e.g." :)!
- pansa2 7y agoHow does Folly compare to Google’s Abseil? https://abseil.io/ https://abseil.io/
- wiineeth 7y agoEven i wonder about this! Also is Abseil widely used in the industry or only at Google?
- yesbabyyes 7y agoOT: wiineeth, your account is shadow banned. I looked through your history and can't really tell why, but you should email hn and ask them to lift the ban, since IMO you don't look like a bad member in a community.
- bluGill 7y agoI doubt it. Google lives at head and breaks things. Industry likes stability in general I have code from 1996 that I still need to support on cpus that were current back then. Nobody has written a new compiler for those cpus so I am stuck with whatever the old compiler supports.
- steerablesafe 7y agoWe just started using it for its flat_hash_map.
- moderation 7y agoAbseil is used extensively in Envoy Proxy. The project is a top level Cloud Native Computing Foundation (CNCF) project however Google are one of the top contributors.
- doctorsher 7y agoBoth are quite similar at a high level. They provide generic utilities for improving synchronization, strings, random number generators, high performance containers, etc. Both are no stable ABI guaranteed, live at head encouraged. At a more detailed level, I find Folly much more substantial than Abseil. For example, both provide high performance hash tables. Abseil also provides a BTree-based map, which Folly does not. But Folly provides concurrent skip lists, LRU evicted hash maps, a high performance MPMC queue, etc. And that's just talking about data structures. Folly also has asynchronous I/O tools, futures, reference-counted buffers for IO, and many other things outside the scope of Abseil. Personally, I am loving the asynchronous I/O mechanisms in Folly. It feels more expressive and results in cleaner code than boost ASIO. Just a first impression though, I am relatively new to the library.
- tuckerpo 7y agoThere's a pretty good CppCon talk about how they made std::string suck less at facebook https://youtu.be/kPR8h4-qZdk https://youtu.be/kPR8h4-qZdk
- binarnosp 7y agoThe fact that the master branch CI has a high rate of failure doesn't inspire confidence in the development process.
- quicklime 7y agoI assume your looking at the runs in GitHub actions? The development process itself is fine. This takes place inside Facebook on their own infrastructure. The problem is their process to automatically sync their internal repo to GitHub and keep the public CI green is broken.
- Jahak 7y agothank you facebook
- fenesiistvan 7y agoSad to see that almost all companies have to implement their own string because of the difficult to use and slow performance std::string.
- rshnotsecure 7y agoDoes anyone know what happened to the Facebook https://opencompute.org https://opencompute.org project? Does anyone actually use that? Seemed interesting at the time but haven't heard much recently.
- dang 7y agoA thread from 2012: https://news.ycombinator.com/item?id=4059356 https://news.ycombinator.com/item?id=4059356
- Traster 7y agoI would've thought there's a better way of approaching software design in 2020 than "This 50,000 employee company decided to open source one big bang grab bag of functions". Especially with a readme that doesn't include any explanation of what's in the library or why they're there. >Folly (acronymed loosely after Facebook Open Source Library) You literally broke your first promise. That literally translates ot FOSL. You could've used FOSL. That's a word. It makes sense. It's even a bit funny. >is a library of C++14 components designed with practicality and efficiency in mind. As opposed to all those components that are designed with impracticality and inefficiency in mind. I honestly don't think I can say I've ever designed anything without those two things in mind. >Folly contains a variety of core library components used extensively at Facebook. Which tells me literally nothing about what's in this library. How do I know what's used extensively at facbook? Last I saw it was mediocre PHP 4.
- shafte 7y agoPerhaps you missed the "What's in it" section while skimming the readme? :) >Because of folly's fairly flat structure, the best way to see what's in it is to look at the headers in top level folly/ directory. You can also check the docs folder for documentation, starting with the overview.
- Traster 7y agoAh, the old "Read the code" version of documentation. Guess what? That's not documentation. That's douchebag for "I didn't write documentation"
- shafte 7y agoThat doesn't seem very fair. They link a docs folder and an overview document, neither of which require that the user read code to get a good idea of the library's contents. That said, the code is also reasonably well commented as well, for example: https://github.com/facebook/folly/blob/master/folly/Singleton.h https://github.com/facebook/folly/blob/master/folly/Singleto.... So "read the code" is not terrible advice in this case either.
- m23khan 7y agoI am quiet impressed by Facebook R&D and whole technology stack they use.