forked from arximboldi/immer
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Baltoli/update-to-upstream
Update to upstream
- Loading branch information
Showing
159 changed files
with
9,106 additions
and
16,105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Load pretty printers | ||
source tools/gdb_pretty_printers/autoload.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,8 @@ __pycache__ | |
tools/clojure/.lein* | ||
|
||
*.pyc | ||
|
||
/result* | ||
|
||
.build | ||
.swiftpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.