Skip to content

Instantly share code, notes, and snippets.

View BillyONeal's full-sized avatar

Billy O'Neal BillyONeal

View GitHub Profile
C:\Users\bion\Desktop>type bench.cpp
#include "benchmark/benchmark.h"
#pragma comment(lib, "benchmark")
#pragma comment(lib, "shlwapi")
#include <stddef.h>
#include <algorithm>
#include <random>
#include <string>
#include <string_view>
C:\Users\bion\Desktop>type bench.cpp
#include "benchmark/benchmark.h"
#pragma comment(lib, "benchmark")
#pragma comment(lib, "shlwapi")
#include <stddef.h>
#include <algorithm>
#include <random>
#include <string>
#include <string_view>
@BillyONeal
BillyONeal / execution.cpp
Created November 18, 2017 02:46
Parallel partition O(n)
// PARALLEL FUNCTION TEMPLATE partition
template<class _FwdIt,
class _Pr>
pair<_FwdIt, _Iter_diff_t<_FwdIt>>
_Partition_swap_backward(_FwdIt _First, const _FwdIt _Last, _FwdIt _Beginning_of_falses, _Pr _Pred)
{ // swap elements in [_First, _Last) satisfying _Pred with elements from _Beginning_of_falses
// pre: _Beginning_of_falses < _First
_Iter_diff_t<_FwdIt> _Trues{};
for (; _First != _Last; ++_First)
{
algorithm:186: _NODISCARD inline _InIt find_if(_InIt _First, const _InIt _Last, _Pr _Pred)
algorithm:207: _NODISCARD _FwdIt find_if(_ExPo&& _Exec, _FwdIt _First, const _FwdIt _Last, _Pr _Pred) _NOEXCEPT;
algorithm:213: _NODISCARD inline _InIt find_if_not(_InIt _First, const _InIt _Last, _Pr _Pred)
algorithm:234: _NODISCARD inline _FwdIt find_if_not(_ExPo&& _Exec, _FwdIt _First, _FwdIt _Last, _Pr _Pred) _NOEXCEPT;
algorithm:240: _NODISCARD inline _FwdIt adjacent_find(const _FwdIt _First, _FwdIt _Last, _Pr _Pred)
algorithm:261: _NODISCARD inline _FwdIt adjacent_find(const _FwdIt _First, const _FwdIt _Last)
algorithm:271: _NODISCARD inline _FwdIt adjacent_find(_ExPo&& _Exec, _FwdIt _First, _FwdIt _Last, _Pr _Pred) _NOEXCEPT;
algorithm:276: _NODISCARD inline _FwdIt adjacent_find(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last) _NOEXCEPT
algorithm:285: _NODISCARD inline _Iter_diff_t<_InIt> count_if(_InIt _First, _InIt _Last, _Pr _Pred)
algorithm:307: _NODISCARD inline _Iter_diff_t<_FwdIt> count_if(_ExPo&& _
@BillyONeal
BillyONeal / execution
Last active November 17, 2017 10:54
Parallel remove_if
// PARALLEL FUNCTION TEMPLATES remove AND remove_if
template<class _InIt,
class _OutIt,
class _Pr>
_OutIt _Remove_move_if_unchecked(_InIt _First, const _InIt _Last, _OutIt _Dest, _Pr _Pred)
{ // move omitting each element satisfying _Pred
for (; _First != _Last; ++_First)
{
if (!_Pred(*_First))
{
@BillyONeal
BillyONeal / append_char.asm
Created September 28, 2017 22:48
String Things
; Function compile flags: /Ogtpy
; COMDAT _append_char
_TEXT SEGMENT
tv636 = -4 ; size = 4
__New_ptr$1$ = 8 ; size = 4
_x$ = 8 ; size = 4
_append_char PROC ; COMDAT
; File c:\users\bion\desktop\test.cpp
; Line 3
00000 51 push ecx
@BillyONeal
BillyONeal / CommandLineProcess.cs
Created September 1, 2017 01:55
Because System.Diagnostics.Process is the worst class in the BCL
// /********************************************************
// * *
// * Copyright (C) Microsoft. All rights reserved. *
// * *
// ********************************************************/
namespace Runall.CLI
{
using System;
using System.Runtime.InteropServices;
// STRUCT TEMPLATE _Static_partition_set
template<class _FwdIt>
struct _Iterator_range
{ // record of a partition of work
_FwdIt _First;
_FwdIt _Last;
explicit operator bool() const
{
return (_First != _Last);
@BillyONeal
BillyONeal / hpx_reverse.cpp
Created June 13, 2017 20:20
HPX reverse comparative
#include <hpx/hpx.hpp>
#include <hpx/hpx_init.hpp>
#include <hpx/parallel/algorithms/reverse.hpp>
#include <algorithm>
#include <execution>
#include <functional>
#include <random>
#include <vector>
#include "stopwatch.hpp"
@BillyONeal
BillyONeal / execution
Created June 13, 2017 06:39
Poor Reverse Perf
// PARALLEL FUNCTION TEMPLATE reverse
template<class _BidIt>
struct _Reverse_partition
{
_BidIt _First;
_BidIt _Stop_at;
_BidIt _Last;
};
template<class _BidIt,