folly/GroupVarint.h

folly/GroupVarint.h is an implementation of variable-length encoding for 32- and 64-bit integers using the Group Varint encoding scheme as described in Jeff Dean's WSDM 2009 talk and in Information Retrieval: Implementing and Evaluating Search Engines.

Briefly, a group of four 32-bit integers is encoded as a sequence of variable length, between 5 and 17 bytes; the first byte encodes the length (in bytes) of each integer in the group. A group of five 64-bit integers is encoded as a sequence of variable length, between 7 and 42 bytes; the first two bytes encode the length (in bytes) of each integer in the group.

GroupVarint.h defines a few classes:

  • GroupVarint<T>, where T is uint32_t or uint64_t:

    Basic encoding / decoding interface, mainly aimed at encoding / decoding one group at a time.

  • GroupVarintEncoder<T, Output>, where T is uint32_t or uint64_t, and Output is a functor that accepts StringPieceobjects as arguments:

    Streaming encoder: add values one at a time, and they will be flushed to the output one group at a time. Handles the case where the last group is incomplete (the number of integers to encode isn't a multiple of the group size)

  • GroupVarintDecoder<T>, where T is uint32_t or uint64_t:

    Streaming decoder: extract values one at a time. Handles the case where the last group is incomplete.

The 32-bit implementation is significantly faster than the 64-bit implementation; on platforms supporting the SSSE3 instruction set, we use the PSHUFB instruction to speed up lookup, as described in SIMD-Based Decoding of Posting Lists(CIKM 2011).

For more details, see the header file folly/GroupVarint.h and the associated test file folly/test/GroupVarintTest.cpp.

GroupVarint的更多相关文章

  1. 今天听说了一个压缩解压整型的方式-group-varint

    group varint https://github.com/facebook/folly/blob/master/folly/docs/GroupVarint.md 这个是facebook的实现 ...

  2. folly学习心得(转)

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

  3. Folly: Facebook Open-source Library Readme.md 和 Overview.md(感觉包含的东西并不多,还是Boost更有用)

    folly/ For a high level overview see the README Components Below is a list of (some) Folly component ...

随机推荐

  1. jQuery 滑动选项卡SmartTab

    Smart Tab Overview Smart Tab is a jQuery plugin for tabbed interface. It is flexible and very easy t ...

  2. Nginx 作为反向代理优化要点proxy_buffering

    当nginx用于反向代理时,每个客户端将使用两个连接:一个用于响应客户端的请求,另一个用于到后端的访问: 那么,可以从如下配置起步: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...

  3. web前端开发中的命名规范

      (一)主体 头:header 内容:content/container 尾:footer 导航:nav 侧栏:sidebar 栏目:column 页面外围控制整体布局宽度:wrapper 左右中: ...

  4. 【商业源码】生日大放送-Newlife商业源码分享 -转

    http://www.cnblogs.com/asxinyu/p/3225179.html   今天是农历六月二十三,是@大石头的生日,记得每年生日都会有很劲爆的重量级源码送出,今天Newlife群和 ...

  5. 华为荣耀8 android 让真机显示 DeBug Log调试信息 (真机调试时不显示 Logcat 日志的解决办法)

    ================================================================ 以下内容转载自: https://blog.csdn.net/aiko ...

  6. rancher下的kubernetes之一:构建标准化vmware镜像

    学习kubernetes的时候,我们需要在kubernetes环境下实战操作,然而kubernetes环境安装并不容易,现在通过rancher可以简化安装过程,咱们来实战rancher下的kubern ...

  7. BZOJ - 4318: OSU! (期望DP&Attention)

    Description osu 是一款群众喜闻乐见的休闲软件.  我们可以把osu的规则简化与改编成以下的样子:  一共有n次操作,每次操作只有成功与失败之分,成功对应1,失败对应0,n次操作对应为1 ...

  8. .NET/C# 使用 Span 为字符串处理提升性能

    .NET Core 2.1 和 C# 7.2 带来了 Span 的原生支持,原本需要使用不安全代码操作的内存块现在可以使用安全的方式来完成.此前在性能和稳定性上需要有所取舍,而现在可以兼得了. 简单的 ...

  9. svn 操作命令

    1.第一次提交代码到svn svn import project_directory PATH 2.将文件checkout到本地svn checkout path(path是服务器上的目录) 例如:s ...

  10. Kanboard 看板工具配置使用

    备注:     类似的开源工具有wekan 界面还有功能和Trello 类似.比较方便   1. 安装(基于docker+ docker-compose) a. 安装docker && ...