folly/FBString.h

fbstring is a drop-in replacement for std::string. The main benefit of fbstring is significantly increased performance on virtually all important primitives. This is achieved by using a three-tiered storage strategy and by cooperating with the memory allocator. In particular, fbstring is designed to detect use of jemalloc and cooperate with it to achieve significant improvements in speed and memory usage.

fbstring supports 32- and 64-bit and little- and big-endian architectures.

Storage strategies


  • Small strings (<= 23 chars) are stored in-situ without memory allocation.

  • Medium strings (24 - 255 chars) are stored in malloc-allocated memory and copied eagerly.

  • Large strings (> 255 chars) are stored in malloc-allocated memory and copied lazily.

Implementation highlights


  • 100% compatible with std::string.

  • Thread-safe reference counted copy-on-write for strings "large" strings (> 255 chars).

  • Uses malloc instead of allocators.

  • Jemalloc-friendly. fbstring automatically detects if application uses jemalloc and if so, significantly improves allocation strategy by using non-standard jemalloc extensions.

  • find() is implemented using simplified Boyer-Moore algorithm. Casual tests indicate a 30x speed improvement overstring::find() for successful searches and a 1.5x speed improvement for failed searches.

  • Offers conversions to and from std::string.

FBString的更多相关文章

  1. Folly解读(零) Fbstring—— 一个完美替代std::string的库

    string 常见的三种实现方式 eager copy COW SSO Fbstring 介绍 Storage strategies Implementation highlights Benchma ...

  2. 用#define来实现多份近似代码 - map,set中的应用

    在stl中map,set内部都是使用相同的红黑树实现,map对应模板参数key_type,mapped_type,而set对应模板参数没有mapped_type 两者都支持insert操作 pair& ...

  3. 转: 在创业公司使用C++

    from: http://oicwx.com/detail/827436 在创业公司使用C++ 2016-01-04开发资讯 James Perry和朋友创办了一家公司,主要是做基于云的OLAP多维数 ...

  4. issues about Facebook Login

    在学习The complete iOS 9 Developer Course - Build 18 Apps 中的Letture134-Facebook Login,需要整合(integrate)Pa ...

  5. Conv

    folly/Conv.h folly/Conv.h is a one-stop-shop for converting values across types. Its main features a ...

  6. DynamicConverter

    folly/DynamicConverter.h When dynamic objects contain data of a known type, it is sometimes useful t ...

  7. ProducerConsumerQueue

    folly/ProducerConsumerQueue.h The folly::ProducerConsumerQueue class is a one-producer one-consumer ...

  8. folly学习心得(转)

    原文地址:  https://www.cnblogs.com/Leo_wl/archive/2012/06/27/2566346.html   阅读目录 学习代码库的一般步骤 folly库的学习心得 ...

  9. Java UDP的简单实例以及知识点简述

    UDP的实现 Java中实现UDP协议的两个类,分别是DatagramPacket数据包类以及DatagramSocket套接字类. 其与TCP协议实现不同的是: UDP的套接字DatagramSoc ...

随机推荐

  1. Deepgreen DB简介(转)

    原文链接   Deepgreen DB 全称 Vitesse Deepgreen DB,它是一个可扩展的大规模并行(通常称为MPP)数据仓库解决方案,起源于开源数据仓库项目Greenplum DB(通 ...

  2. vue和react

    1. 数据渲染 vue是使用template模板进行渲染,react使用的是jsx语法,对组件进行渲染 vue模板中使用{{ this.data }} 双括号包着变量,代表变量表示的值.外面那层表示需 ...

  3. python 多维list声明时的小问题

    a=[[]]*3 a Out[18]: [[], [], []] a[0].append(1) a Out[20]: [[1], [1], [1]] b=[[] for _ in range(3)] ...

  4. js之侧边栏分享

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  5. Git 中文教程

    以下内容转载自:http://www.open-open.com/lib/view/open1328928294702.html Git是一个分布式的版本控制工具,本篇文章从介绍Git开始,重点 在于 ...

  6. sersync2 文件的实时同步备份

    |——需求: 监控192.168.9.5[主]  下的 /data/vmeipai 目录  --> 同步到 192.168.12.8 [备] 下的 /data/vmeipai 目录 |——网络拓 ...

  7. 模块(Modules)

    一.引入模块 模块:当编写更大的应用程序时,所有的代码肯定会分成多个文件,这样便于维护,另外已经编写好的函数和对象在被多个程序中使用时,不用把函数和对象拷贝到每个程序中. 模块支持以上功能,在Pyth ...

  8. 自己理解的java工厂模式,希望对大家有所帮助

    [http://www.360doc.com/content/11/0824/17/3034429_142983837.shtml] 这两天突然想学学java源代码,不过看到一篇文章说看java源代码 ...

  9. python笔记-11 rabbitmq

    一.理解rabbitmq的基本背景 1.理解消息队列 1.1 普通queue 在前面的博客中所提到的队列,此处均称之为普通队列 简述一下普通队列的一些分类及不足 1.1.1 基本Queue:queue ...

  10. Prometheus 简介

    Prometheus 是一个开源的服务监控系统和时间序列数据库. 特性: 高维度数据模型 自定义查询语言 可视化数据展示 高效的存储策略 易于运维 提供各种客户端开发库 警告和报警 数据导出   gi ...