Abseil Blog

    Announcing TCMalloc

    12 Feb 2020

    By Chris Kennelly, Google Software Engineer

    We are happy to announce the arrival of TCMalloc, a fast memory allocator with useful profiling and introspection features.

    The source code can be found on Github. This is a distinct repository, allowing Abseil to be used independently of TCMalloc. The library includes:

    • A lockfree, per-CPU cache implementation based on restartable sequences, available on modern Linux kernels, and a per-thread based fallback implementation.
    • A hugepage-aware backend that reduces TLB stalls by more densely populating hugepage subregions while reducing memory waste.
    • Optimizations leveraging modern C++ language features, including sized delete from C++14 and overaligned allocation from C++17.
    • Always-on, sampling-based heap profiling, allowing an application to obtain a heap profile without additional configuration. We also provide a “peak heap” profile, a snapshot of the application’s memory usage near its high watermark of usage.

    Read more


    Abseil Random

    21 Nov 2019

    By Andy Soffer, Engineer

    We are happy to announce the arrival of the Abseil Random library, providing simple tools for generating random numbers and testing code that uses random numbers.

    Abseil now includes a random number generation library, which can be found in absl/random/. The library includes

    Read more


    Introducing Abseil Options

    15 Nov 2019

    By Greg Falcon, Abseil Engineer

    Abseil now provides an options file, providing a limited means of configuring Abseil’s features. In the initial release of this options mechanism, we have added the ability to override Abseil’s automatic type detection and force (for example) absl::string_view to either always alias to std::string_view, or always remain using our Abseil implementation.

    Read more


    B-tree Ordered Containers

    12 Aug 2019

    By Evan Brown, Engineer

    The Abseil container library now includes B-tree containers that generally conform to the STL sorted container APIs:

    • absl::btree_set (meant to replace usage of std::set)
    • absl::btree_map (meant to replace usage of std::map)
    • absl::btree_multiset (meant to replace usage of std::multiset)
    • absl::btree_multimap (meant to replace usage of std::multimap)

    You use a B-tree container just as you would an STL ordered container:

    #include "absl/container/btree_map.h"
    
    absl::btree_map<int, std::string> ducks =
        {{2, "dewey"}, {1, "huey"}, {3, "louie"},};
    
    // Prints "huey, dewey, louie "
    for (const auto& n : ducks) {
        std::cout << n.second << ", ";
    }
    

    B-trees have a different implementation from STL std::map containers, which require binary trees commonly implemented as red-black trees. While a red-black tree is limited to single-element nodes, with precisely two children, a B-tree may contain multiple values per node (M), with each node having (M+1) children. Having more values and children per node is more cache friendly because nodes are generally allocated separately so accessing additional nodes often results in cache misses.

    Read more


    Abseil Flags

    09 May 2019

    By Gennadiy Rozental, Abseil Engineer

    Abseil is very happy to announce the release of the Abseil Flags library. Abseil’s flags library provides a standard, readable way to pass command-line values to a program.

    #include <iostream>
    #include <string>
    
    #include "absl/flags/flag.h"
    #include "absl/flags/parse.h"
    
    ABSL_FLAG(std::string, name, "you", "Name of the person to greet");
    
    int main(int argc, char** argv) {
      absl::ParseCommandLine(argc, argv);
      std::cout << "Hello " << absl::GetFlag(FLAGS_name) << "!" << std::endl;
      return 0;
    }
    
    $ greet
    Hello you!
    $ greet --name=Alice
    Hello Alice!
    

    Read more



Subscribe to the Abseil Blog