Skip to content

Commit

Permalink
Merge #6377: depends: update 'src/immer' to arximboldi/immer@5875f773
Browse files Browse the repository at this point in the history
…as c0b716f2

f18e839 build: drop symlinks in immer subtree (Kittywhiskers Van Gogh)
d761111 build: fix gitian builds (Kittywhiskers Van Gogh)
a9f46b3 Squashed 'src/immer/' changes from 9cb6a5a845..5875f7739a (Kittywhiskers Van Gogh)
e4ee302 revert: fix gitian builds (Kittywhiskers Van Gogh)
fb00300 revert: drop symlinks in immer subtree (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * Dependency for #6380

  #6380 will be using `std::ranges` as a replacement for [dash#4622](#4622) and currently, it will fail to compile due to the current version of `immer` (last updated two years ago in #4911) not meeting constraints ([source](https://en.cppreference.com/w/cpp/language/constraints)) set by `std::ranges` (see below).

  ```
  ./evo/deterministicmns.h:243:16: error: no matching function for call to object of type 'const __count_if_fn'
          return ranges::count_if(mnMap, [](const auto& p) { return IsMNValid(*p.second); });
                 ^~~~~~~~~~~~~~~~
  /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/ranges_algo.h:331:7: note: candidate template ignored: substitution failure [with _Range = const MnMap &, _Proj = identity, _Pred = (lambda at ./evo/deterministicmns.h:243:40)]: constraints not satisfied for alias template 'range_difference_t' [with _Range = const immer::map<uint256, std::shared_ptr<const CDeterministicMN>, CDeterministicMNList::ImmerHasher> &]
        operator()(_Range&& __r, _Pred __pred, _Proj __proj = {}) const
        ^
  /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/ranges_algo.h:316:7: note: candidate function template not viable: requires at least 3 arguments, but 2 were provided
        operator()(_Iter __first, _Sent __last,
        ^
  ```

  This has been resolved by updating `immer` to the latest available release, [v0.8.1](https://github.com/arximboldi/immer/releases/tag/v0.8.1).

  Expected subtree hash **without changes** are `a5ded361aec714bc74149909c5e1984c10ab132c4c539c63fe57362dccd95556` (see [here](#6323 (review)) for verification instructions).

  ## Breaking Changes

  None expected.

  ## Checklist

  - [x] I have performed a self-review of my own code **(note: N/A)**
  - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)**
  - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)**
  - [x] I have made corresponding changes to the documentation **(note: N/A)**
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    utACK f18e839
  UdjinM6:
    utACK f18e839

Tree-SHA512: 99d1b577eb4cf3fcc3ebfd28f19006700f085d23ccdabe802a2aa5844e4b39314347b0c0e49a352c5fc034d6584a0109edf08fa3c0846514967f1fb16e7f127a
  • Loading branch information
PastaPastaPasta committed Nov 4, 2024
2 parents 444d7a9 + f18e839 commit a8e2316
Show file tree
Hide file tree
Showing 154 changed files with 8,822 additions and 24,491 deletions.
2 changes: 2 additions & 0 deletions src/immer/.gdbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Load pretty printers
source tools/gdb_pretty_printers/autoload.py
26 changes: 26 additions & 0 deletions src/immer/.github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CIFuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'immer'
dry-run: false
language: c++
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'immer'
fuzz-seconds: 300
dry-run: false
language: c++
- name: Upload Crash
uses: actions/upload-artifact@v3
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts
35 changes: 20 additions & 15 deletions src/immer/.github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,46 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # needed for fetchGit in default.nix
- uses: cachix/install-nix-action@v12
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: "https://releases.nixos.org/nix/nix-2.3.16/install"
- uses: cachix/cachix-action@v8
- uses: cachix/cachix-action@v12
with:
name: arximboldi
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: nix-build

build-spm:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: swift build

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: cachix/install-nix-action@v12
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: "https://releases.nixos.org/nix/nix-2.3.16/install"
- uses: cachix/cachix-action@v8
- uses: cachix/cachix-action@v12
with:
name: arximboldi
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: nix-shell --run "mkdir build"
- run: nix-shell --run "cd build && cmake .."
- run: nix-shell --run "cd build && make docs"
- uses: shimataro/ssh-key-action@v2
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' && github.repository_owner == 'arximboldi'
with:
key: ${{ secrets.SINUSOIDES_SSH_KEY }}
known_hosts: ${{ secrets.SINUSOIDES_KNOWN_HOSTS }}
- run: nix-shell --run "cd build && make upload-docs"
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' && github.repository_owner == 'arximboldi'

check:
strategy:
Expand Down Expand Up @@ -74,7 +80,7 @@ jobs:
- type: Debug
toolchain: llvm-8
std: 14
opts: ['sanitizer']
opts: ['sanitize']
# benchmarks
- type: Release
toolchain: gnu-9
Expand All @@ -87,11 +93,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v12
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: "https://releases.nixos.org/nix/nix-2.3.16/install"
- uses: cachix/cachix-action@v8
- uses: cachix/cachix-action@v12
with:
name: arximboldi
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
Expand All @@ -113,11 +118,11 @@ jobs:
"
- run: nix-shell --argstr toolchain ${{ matrix.toolchain }} --run "cd build && make check -j`nproc`"
- run: nix-shell --argstr toolchain ${{ matrix.toolchain }} --run "bash <(curl -s https://codecov.io/bash)"
if: ${{ contains(matrix.opts, 'coverage') }}
if: contains(matrix.opts, 'coverage')
- uses: shimataro/ssh-key-action@v2
if: ${{ contains(matrix.opts, 'benchmark') }}
if: contains(matrix.opts, 'benchmark') && github.repository_owner == 'arximboldi'
with:
key: ${{ secrets.SINUSOIDES_SSH_KEY }}
known_hosts: ${{ secrets.SINUSOIDES_KNOWN_HOSTS }}
- run: nix-shell --run "cd build && make upload-benchmark-reports"
if: ${{ contains(matrix.opts, 'benchmark') }}
if: contains(matrix.opts, 'benchmark') && github.repository_owner == 'arximboldi'
5 changes: 5 additions & 0 deletions src/immer/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ __pycache__
tools/clojure/.lein*

*.pyc

/result*

.build
.swiftpm
12 changes: 11 additions & 1 deletion src/immer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_policy(SET CMP0048 NEW) # enable project VERSION
cmake_policy(SET CMP0056 NEW) # honor link flags in try_compile()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

project(immer VERSION 0.7.0)
project(immer VERSION 0.8.0)

if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-extended-offsetof -Wno-c++17-extensions -Wno-c++1z-extensions -Wno-unknown-warning-option -Wno-type-limits")
Expand Down Expand Up @@ -99,6 +99,14 @@ install(TARGETS immer EXPORT ImmerConfig)
install(EXPORT ImmerConfig DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Immer")
install(DIRECTORY immer DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/ImmerConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion )

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ImmerConfigVersion.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Immer" )

# development target to be used in tests, examples, benchmarks...
immer_canonicalize_cmake_booleans(
DISABLE_FREE_LIST
Expand Down Expand Up @@ -131,6 +139,8 @@ endif()
if (immer_BUILD_TESTS)
enable_testing()

find_package(Catch2 REQUIRED)

add_custom_target(check
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
Expand Down
29 changes: 29 additions & 0 deletions src/immer/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "immer",
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "immer",
targets: ["immer"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "immer",
dependencies: [],
path: ".",
sources: ["spm.cpp"],
publicHeadersPath: ".")
],
cxxLanguageStandard: .cxx14
)
9 changes: 6 additions & 3 deletions src/immer/README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. image:: https://github.com/arximboldi/immer/workflows/test/badge.svg
:target: https://github.com/arximboldi/immer/actions?query=workflow%3Atest+branch%3Amaster
:alt: Github Actions Badge
:alt: GitHub Actions Badge

.. image:: https://codecov.io/gh/arximboldi/immer/branch/master/graph/badge.svg
:target: https://codecov.io/gh/arximboldi/immer
Expand All @@ -13,7 +13,10 @@

.. raw:: html

<img width="100%" src="https://cdn.rawgit.com/arximboldi/immer/3888170d247359cc0905eed548cd46897caef0f4/doc/_static/logo-front.svg" alt="Logotype"/>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.rawgit.com/arximboldi/immer/3888170d247359cc0905eed548cd46897caef0f4/doc/_static/logo-black.svg">
<img width="100%" src="https://cdn.rawgit.com/arximboldi/immer/3888170d247359cc0905eed548cd46897caef0f4/doc/_static/logo-front.svg" alt="Logotype">
</picture>

.. include:introduction/start
Expand Down Expand Up @@ -74,7 +77,7 @@ Example
For a **complete example** check `Ewig, a simple didactic
text-editor <https://github.com/arximboldi/ewig>`_ built with this
library. You may also wanna check `Lager, a Redux-like library
<https://github.com/arximboldi/lager>`_ for writting interactive
<https://github.com/arximboldi/lager>`_ for writing interactive
software in C++ using a value-oriented design.


Expand Down
85 changes: 85 additions & 0 deletions src/immer/benchmark/set/erase.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
//
// immer: immutable data structures for C++
// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente
//
// This software is distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt
//

#pragma once

#include "benchmark/config.hpp"

#include <boost/container/flat_set.hpp>
#include <hash_trie.hpp> // Phil Nash
#include <immer/set.hpp>
#include <immer/set_transient.hpp>
#include <set>
#include <unordered_set>

namespace {

template <typename Generator, typename Set>
auto benchmark_erase_mut_std()
{
return [](nonius::chronometer meter) {
auto n = meter.param<N>();
auto g = Generator{}(n);
auto v_ = [&] {
auto v = Set{};
for (auto i = 0u; i < n; ++i)
v.insert(g[i]);
return v;
}();
measure(meter, [&] {
auto v = v_;
for (auto i = 0u; i < n; ++i)
v.erase(g[i]);
return v;
});
};
}

template <typename Generator, typename Set>
auto benchmark_erase()
{
return [](nonius::chronometer meter) {
auto n = meter.param<N>();
auto g = Generator{}(n);
auto v_ = [&] {
auto v = Set{}.transient();
for (auto i = 0u; i < n; ++i)
v.insert(g[i]);
return v.persistent();
}();
measure(meter, [&] {
auto v = v_;
for (auto i = 0u; i < n; ++i)
v = v.erase(g[i]);
return v;
});
};
}

template <typename Generator, typename Set>
auto benchmark_erase_move()
{
return [](nonius::chronometer meter) {
auto n = meter.param<N>();
auto g = Generator{}(n);
auto v_ = [&] {
auto v = Set{}.transient();
for (auto i = 0u; i < n; ++i)
v.insert(g[i]);
return v.persistent();
}();
measure(meter, [&] {
auto v = v_;
for (auto i = 0u; i < n; ++i)
v = std::move(v).erase(g[i]);
return v;
});
};
}

} // namespace
44 changes: 44 additions & 0 deletions src/immer/benchmark/set/erase.ipp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// immer: immutable data structures for C++
// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente
//
// This software is distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt
//

#include "erase.hpp"

#ifndef GENERATOR_T
#error "you must define a GENERATOR_T"
#endif

using generator__ = GENERATOR_T;
using t__ = typename decltype(generator__{}(0))::value_type;

// clang-format off
NONIUS_BENCHMARK("std::set", benchmark_erase_mut_std<generator__, std::set<t__>>())
NONIUS_BENCHMARK("std::unordered_set", benchmark_erase_mut_std<generator__, std::unordered_set<t__>>())
NONIUS_BENCHMARK("boost::flat_set", benchmark_erase_mut_std<generator__, boost::container::flat_set<t__>>())
// Phil Nash's hash_trie seems to not include an erase operation... at least at
// the version that we have included in the nix-shell here...
// NONIUS_BENCHMARK("hamt::hash_trie", benchmark_erase_mut_hash_trie<generator__, hamt::hash_trie<t__>>())

NONIUS_BENCHMARK("immer::set/5B", benchmark_erase<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,5>>())
NONIUS_BENCHMARK("immer::set/4B", benchmark_erase<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,4>>())
#ifndef DISABLE_GC_BENCHMARKS
NONIUS_BENCHMARK("immer::set/GC", benchmark_erase<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,gc_memory,5>>())
#endif
NONIUS_BENCHMARK("immer::set/UN", benchmark_erase<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,unsafe_memory,5>>())

NONIUS_BENCHMARK("immer::set/move/5B", benchmark_erase_move<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,5>>())
NONIUS_BENCHMARK("immer::set/move/4B", benchmark_erase_move<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,4>>())
NONIUS_BENCHMARK("immer::set/move/UN", benchmark_erase_move<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,unsafe_memory,5>>())

NONIUS_BENCHMARK("immer::set/tran/5B", benchmark_erase_mut_std<generator__, immer::set_transient<t__, std::hash<t__>,std::equal_to<t__>,def_memory,5>>())
NONIUS_BENCHMARK("immer::set/tran/4B", benchmark_erase_mut_std<generator__, immer::set_transient<t__, std::hash<t__>,std::equal_to<t__>,def_memory,4>>())
#ifndef DISABLE_GC_BENCHMARKS
NONIUS_BENCHMARK("immer::set/tran/GC", benchmark_erase_mut_std<generator__, immer::set_transient<t__, std::hash<t__>,std::equal_to<t__>,gc_memory,5>>())
#endif
NONIUS_BENCHMARK("immer::set/tran/UN", benchmark_erase_mut_std<generator__, immer::set_transient<t__, std::hash<t__>,std::equal_to<t__>,unsafe_memory,5>>())

// clang-format on
Loading

0 comments on commit a8e2316

Please sign in to comment.