Skip to content

Instantly share code, notes, and snippets.

View BillyONeal's full-sized avatar

Billy O'Neal BillyONeal

View GitHub Profile
template<class _RanIt,
class _Pr>
bool _Process_sort_work_item(const _RanIt _Basis, _Pr _Pred, _Sort_work_item<_RanIt>& _Wi,
_Sort_work_item<_RanIt>& _Right_fork_wi,
_Iter_diff_t<_RanIt>& _Work_complete) noexcept // enforces termination
{ // processes the sort work item, _Wi, relative to _Basis
// if the sort is divided into quicksort sub-problems:
// the return value is true
// _Wi contains the left sub-problem; the caller should continue with this
// _Right_fork_wi contains the right sub-problem; the caller should allow this to be stolen
// compile with:
// release: cl /EHsc /W4 /WX /std:c++latest /Festable_sort /MD /O2 .\sort.cpp
#include <stddef.h>
#include <stdio.h>
#include <algorithm>
#include <chrono>
#include <random>
#include <execution>
#include <ratio>
#include <charconv>
#include <string>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <vector>
#include <random>
#include <benchmark/benchmark.h>
using namespace std;
#include <string>
#include <iterator>
#include <list>
#include <vector>
#include <random>
#include <benchmark/benchmark.h>
using std::string;
using std::vector;
using std::list;
@BillyONeal
BillyONeal / bitset.cpp
Created August 29, 2018 07:18
Bitset Bench
#include <bitset>
#include <benchmark/benchmark.h>
const char bitText[] =
"0100010100111101100001010100101010011101011110001000101101101001"
"0110011011101100001101001111111101111011101000111000100101011110"
"0001010000010000111001101001101001110111000011100101011100101010"
"0000010110110110110010001111011000100000011000000000001010000011"
"1101010111000001011011010111010100001110110111111100110000101111"
"1010100100000011011000001011110000000111111001000010010100110000"
@BillyONeal
BillyONeal / Results.txt
Created July 25, 2018 21:15
Unicode CVT
D:\build>.\codeset_conversion.exe
07/25/18 14:13:25
Running .\codeset_conversion.exe
Run on (12 X 2904 MHz CPU s)
CPU Caches:
L1 Data 32K (x6)
L1 Instruction 32K (x6)
L2 Unified 262K (x6)
L3 Unified 12582K (x1)
-----------------------------------------------------------------------------
D:\build>type ..\vclib-benchmarks\benchmarks\make_pair_str.cpp
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <random>
#include <benchmark/benchmark.h>
using namespace std;
_NODISCARD inline unique_ptr<wchar_t[]> _Get_cleaned_symlink_target(const path& _To) noexcept
{ // transforms /s in the root-name to \s, and all other directory-separators into single \s
// example: a/\/b -> a\b
// example: //server/a////////b////////c////////d -> \\server\a\b\c\d
const auto& _To_str = _To.native();
// protected from overflow by wstring's max_size cap:
unique_ptr<wchar_t[]> _Cleaned_link(::new (nothrow) wchar_t[_To_str.size() + 1]);
if (!_Cleaned_link)
{
return (_Cleaned_link);
#include <assert.h>
#include <utility>
#include <execution>
#include <algorithm>
struct fuel {
fuel() = delete;
explicit fuel(int) {};
fuel(const fuel&) = delete;
fuel& operator=(const fuel&) = delete;
@BillyONeal
BillyONeal / filesystem.cpp
Created April 3, 2018 06:11
Filesystem Stats
[[nodiscard]] __std_win_error __stdcall __std_fs_get_stats(const wchar_t * const _Path, __std_fs_stats * const _Stats,
__std_fs_stats_flags _Flags, const __std_fs_file_attr _Symlink_attribute_hint) noexcept
{
static_assert((offsetof(_Aligned_file_attrs, _Data._Last_write_time) % 8) == 0, "_Last_write_time not aligned");
static_assert(sizeof(_File_attr_data) == sizeof(WIN32_FILE_ATTRIBUTE_DATA));
static_assert(alignof(_File_attr_data) == alignof(WIN32_FILE_ATTRIBUTE_DATA));
static_assert(alignof(_File_attr_data) == 4);
const bool _Follow_symlinks = _Bitmask_includes(_Flags, __std_fs_stats_flags::_Follow_symlinks);
_Flags &= ~__std_fs_stats_flags::_Follow_symlinks;