zoukankan      html  css  js  c++  java
  • FBString

    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.

  • 相关阅读:
    PHP做Web开发的MVC框架(Smarty使用说明 )
    PHP + Smarty + html5 构建Wap应用
    HTML5游戏中动画帧的概念理解
    [转]jQuery选择器 (详解)
    2014马年应该有怎么样的学习方式和思考原则
    html5视频播放解决方案
    html5学习摘要
    sqlserver2008行锁
    关于一些url中传递参数有空格问题
    MongoDB和Redis区别
  • 原文地址:https://www.cnblogs.com/lenmom/p/9359166.html
Copyright © 2011-2022 走看看