3 ms·
Yeah, and if I want to use it I need to replace std::string all around my code. I can't use it for other libraries, unless I replace and recompile them. And t
by raverbashing 12y ago
Yeah, and if I want to use it I need to replace std::string all around my code.
I can't use it for other libraries, unless I replace and recompile them.
And tomorrow a new library comes I need to replace everything again.
Your effort is commendable, and I know squeezing gains are important in the case of fb, but in the end it's just locking yourself in a library that should've been a second though/built in.
- Cthulhu_ 12y ago1. Find / replace, I'm sure the API is simple enough and performance gains are worth the effort. 3. You don't need to replace anything, ever - only if you feel like your string performance is lacking, and that particular new library satisfies your needs (in terms of effort vs performance gains). I don't get why people believe that whenever something new comes out they have to switch over, and as a result are terrified of innovation. 4. I disagree with the "should've been built in" statement; the default std::string implementation is good enough for most (like any std:: thing). Besides, std:string was designed 25+ years ago, over a dozen CPU generations ago; the demands of today are must different.
- raverbashing 12y agoI agree with most points, but "std:string was designed 25+ years ago, over a dozen CPU generations ago; the demands of today are must different." Sure, but you don't need to break the API for that You can replace the allocator in a C program without changing malloc/free to something else, this might have been a design goal. This way you can go back and forth to it, run your tests again, compare performance again, etc
- orbitur 12y agoSo what are you saying exactly? Stick with std::string until the the stdlib devs make it better? I don't think find/replace and including this library until something better comes along is an insurmountable problem.
- im2w1l 12y agoIf only they all implemented something like java.lang.CharSequence... "A CharSequence is a readable sequence of char values. This interface provides uniform, read-only access to many different kinds of char sequences. "
- nostrademons 12y agoNot necessarily - you can find the system headers on your machine and then do 'cp folly/FBString.h /usr/include/c++/4.9.1/string', and then every time you do #include <string> it will pick up Folly's FBString. If a new version comes out, just drop it there. If you're a large corporation, just modify your build system to use your custom standard headers. It sounds like this is what Facebook does - no Facebook code actually references FBString, it just uses std::string and Facebook's implementation of std::string is the Folly version. Google does something similar, where they replaced std::string with their own more efficient version, and everybody just uses it like a normal string.