[PR #5092] [MERGED] Update til::bitmap to use dynamic_bitset<> + libpopcnt #26101

Open
opened 2026-01-31 09:13:55 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/5092
Author: @miniksa
Created: 3/23/2020
Status: Merged
Merged: 3/25/2020
Merged by: @undefined

Base: masterHead: dev/miniksa/dyn_bitset


📝 Commits (5)

  • dacbd34 Import pinam45/dynamic_bitset and optional dependency kimwalisch/libpopcnt. Update NOTICE, include LICENSES, add all governance traceback. Include in common paths and common library imports.
  • 1bc35ed Integrate into bitmap.
  • d8b6263 Remove old statement about std::vector
  • e940c18 SA fix, noexcept. Add includes to universal project path.
  • 338b608 Merge branch 'master' into dev/miniksa/dyn_bitset

📊 Changes

14 files changed (+2988 additions, -34 deletions)

View changed files

📝 NOTICE.md (+68 -1)
dep/dynamic_bitset/LICENSE (+21 -0)
dep/dynamic_bitset/MAINTAINER_README.md (+17 -0)
dep/dynamic_bitset/cgmanifest.json (+13 -0)
dep/dynamic_bitset/dynamic_bitset.hpp (+1944 -0)
dep/libpopcnt/LICENSE (+26 -0)
dep/libpopcnt/MAINTAINER_README.md (+17 -0)
dep/libpopcnt/cgmanifest.json (+13 -0)
dep/libpopcnt/libpopcnt.h (+841 -0)
📝 src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj (+1 -1)
📝 src/common.build.pre.props (+1 -1)
📝 src/inc/LibraryIncludes.h (+7 -0)
📝 src/inc/til/bitmap.h (+14 -19)
📝 src/til/ut_til/BitmapTests.cpp (+5 -12)

📄 Description

This commit replaces std::vector<bool> with dynamic_bitset<> by
@pinam45 (https://github.com/pinam45/dynamic_bitset) and with
libpopcnt for high-performance bit counting by @kimwalisch
(https://github.com/kimwalisch/libpopcnt).

  • In support of performance, incremental rendering, and Terminal
    "not speed enough" as well as my sanity relative to
    std::vector<bool>
  • Tests updated and passed.
  • LICENSE, NOTICE, and provenance files updated.
  • I'm a core contributor. I discussed it with @DHowett-MSFT and
    cleared the licensing checks before pulling this in.

Details std::vector<bool> provided by the Microsoft VC Runtime is

incapable of a great many things. Many of the methods you come to expect
off of std::vector<T> that are dutifully presented through the bool
variant will spontaneously fail at some future date because it decides
you allocated, resized, or manipulated the vector<bool> specialization
in an unsupported manner. Half of the methods will straight up not work
for filling/resizing in bulk. And you will tear your hair out as it will
somehow magically forget the assignment of half the bits you gave it
part way through an iteration then assert out and die.

As such, to preserve my sanity, I searched for an alternative. I came
across the self-contained header-only library dynamic_bitset by
@pinam45 which appears to do as much of boost::dynamic_bitset as I
wanted, but without including 400kg of boost libraries. It also has a
nifty optional dependency on libpopcnt by @kimwalisch that will use
processor-specific extensions for rapidly counting bits. @DHowett-MSFT
and I briefly discussed how nice popcnt would have been on
std::vector<bool> last week... and now we can have it. (To be fair, I
don't believe I'm using it yet... but we'll be able to easily dial in
til::bitmap soon and not worry about a performance hit if we do have
to walk bits and count them thanks to libpopcnt.)

This PR specifically focuses on swapping the dependencies out and
ingesting the new libraries. We'll further tune til::bitmap in future
pulls as necessary.

Validation

  • Ran the automated tests for bitmap.
  • Ran the terminal manually and it looks fine still.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/5092 **Author:** [@miniksa](https://github.com/miniksa) **Created:** 3/23/2020 **Status:** ✅ Merged **Merged:** 3/25/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/miniksa/dyn_bitset` --- ### 📝 Commits (5) - [`dacbd34`](https://github.com/microsoft/terminal/commit/dacbd349ef2537b1c7e8a8c8bf0e026c5ace844f) Import pinam45/dynamic_bitset and optional dependency kimwalisch/libpopcnt. Update NOTICE, include LICENSES, add all governance traceback. Include in common paths and common library imports. - [`1bc35ed`](https://github.com/microsoft/terminal/commit/1bc35ed93092f76f0831fd891eccd07e89d0bfc4) Integrate into bitmap. - [`d8b6263`](https://github.com/microsoft/terminal/commit/d8b6263dde5f67025a2b4284253e00d9b14b8bfb) Remove old statement about std::vector<bool> - [`e940c18`](https://github.com/microsoft/terminal/commit/e940c18312847569ccf46eba6582c1411a6bbe04) SA fix, noexcept. Add includes to universal project path. - [`338b608`](https://github.com/microsoft/terminal/commit/338b6089af746a8f0a49bff225ef728ad21cd0a5) Merge branch 'master' into dev/miniksa/dyn_bitset ### 📊 Changes **14 files changed** (+2988 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `NOTICE.md` (+68 -1) ➕ `dep/dynamic_bitset/LICENSE` (+21 -0) ➕ `dep/dynamic_bitset/MAINTAINER_README.md` (+17 -0) ➕ `dep/dynamic_bitset/cgmanifest.json` (+13 -0) ➕ `dep/dynamic_bitset/dynamic_bitset.hpp` (+1944 -0) ➕ `dep/libpopcnt/LICENSE` (+26 -0) ➕ `dep/libpopcnt/MAINTAINER_README.md` (+17 -0) ➕ `dep/libpopcnt/cgmanifest.json` (+13 -0) ➕ `dep/libpopcnt/libpopcnt.h` (+841 -0) 📝 `src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj` (+1 -1) 📝 `src/common.build.pre.props` (+1 -1) 📝 `src/inc/LibraryIncludes.h` (+7 -0) 📝 `src/inc/til/bitmap.h` (+14 -19) 📝 `src/til/ut_til/BitmapTests.cpp` (+5 -12) </details> ### 📄 Description This commit replaces `std::vector<bool>` with `dynamic_bitset<>` by @pinam45 (https://github.com/pinam45/dynamic_bitset) and with `libpopcnt` for high-performance bit counting by @kimwalisch (https://github.com/kimwalisch/libpopcnt). * [x] In support of performance, incremental rendering, and Terminal "not speed enough" as well as my sanity relative to `std::vector<bool>` * [x] Tests updated and passed. * [x] `LICENSE`, `NOTICE`, and provenance files updated. * [x] I'm a core contributor. I discussed it with @DHowett-MSFT and cleared the licensing checks before pulling this in. ## Details `std::vector<bool>` provided by the Microsoft VC Runtime is incapable of a great many things. Many of the methods you come to expect off of `std::vector<T>` that are dutifully presented through the `bool` variant will spontaneously fail at some future date because it decides you allocated, resized, or manipulated the `vector<bool>` specialization in an unsupported manner. Half of the methods will straight up not work for filling/resizing in bulk. And you will tear your hair out as it will somehow magically forget the assignment of half the bits you gave it part way through an iteration then assert out and die. As such, to preserve my sanity, I searched for an alternative. I came across the self-contained header-only library `dynamic_bitset` by @pinam45 which appears to do as much of `boost::dynamic_bitset` as I wanted, but without including 400kg of boost libraries. It also has a nifty optional dependency on `libpopcnt` by @kimwalisch that will use processor-specific extensions for rapidly counting bits. @DHowett-MSFT and I briefly discussed how nice `popcnt` would have been on `std::vector<bool>` last week... and now we can have it. (To be fair, I don't believe I'm using it yet... but we'll be able to easily dial in `til::bitmap` soon and not worry about a performance hit if we do have to walk bits and count them thanks to `libpopcnt`.) This PR specifically focuses on swapping the dependencies out and ingesting the new libraries. We'll further tune `til::bitmap` in future pulls as necessary. ## Validation * [x] Ran the automated tests for bitmap. * [x] Ran the terminal manually and it looks fine still. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:13:55 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26101