$ clang++ bm_split.cpp -lbenchmark -pthread -O3 && ./a.out
2020-03-20 19:35:24
Running ./a.out
Run on (4 X 2800 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x4)
L1 Instruction 32 KiB (x4)
L2 Unified 256 KiB (x4)
L3 Unified 6144 KiB (x1)
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
function main() { | |
return union( | |
difference( | |
cylinder({r: 25 / 2., h: 3}), | |
cylinder({r: 22 / 2., h: 2}).translate([0,0,1]) | |
), | |
difference( | |
intersection( | |
cylinder({r: 20.0 / 2.0, h: 7}), | |
cube({size: [20., 15, 7], center: true}).translate([0,0, 3.5]) |
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
#include <sgl/sgl.h> | |
#include <iostream> | |
#include <vector> | |
#include <string> | |
int main() { | |
sgl::v1::mmap<char> text("text.txt"); | |
char* text_first = std::begin(text); | |
char* text_last = std::end(text); | |
size_t lines_count = std::count(text_first, text_last, '\n'); |
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
int const* custom_partition_point(int const* first, int const* last) { | |
while (last - first > 1) { | |
int const* middle = first + (last - first) / 2; | |
if (*(middle - 1) < *middle) { | |
last = middle - 1; | |
} else { | |
first = middle; | |
} | |
} | |
if (*first < *(first + 1)) { |
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
// Prototype partial implementation of the proposed <execution> header, | |
// from P0443R12 + P2006R0 | |
#include <https://gist.githubusercontent.com/ericniebler/8cc25656a0a496bd682edc8314d9576b/raw/2c20ea65a5f2ffe625e05a77c7ba30e57a0f0ffd/execution.h> | |
#include <compare> | |
#include <cstdio> | |
#include <optional> | |
namespace ex = std::execution; | |
///////////////////////////////////////////////////////////////////////// |
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
#include <iostream> | |
#include <stlab/concurrency/channel.hpp> | |
#include <stlab/concurrency/concurrency.hpp> | |
#include <stlab/concurrency/serial_queue.hpp> | |
struct object_t { | |
int a, b, c; | |
object_t() = default; | |
object_t(const object_t&) = default; |
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
// g++ u8.cpp -O3 -licuuc -licuio && ./a.out | |
#include <string> | |
#include <unicode/unistr.h> | |
#include <unicode/ustream.h> | |
#include <unicode/locid.h> | |
int main() { | |
std::string source = "Привет"; | |
icu::UnicodeString a(source.data(), "utf-8"); |
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
transformbench.cpp:134:19: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] | |
return N(sqrt(abs(x + y))); | |
^ | |
/usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_algo.h:4327:14: note: in instantiation of member function 'square_root<long>::operator()' requested here | |
*__result = __binary_op(*__first1, *__first2); | |
^ | |
transformbench.cpp:152:10: note: in instantiation of function template specialization 'std::transform<__gnu_cxx::__normal_iterator<const long *, std::vector<long, std::allocator<long> > >, __gnu_cxx::__normal_iterator<const long *, | |
std::vector<long, std::allocator<long> > >, __gnu_cxx::__normal_iterator<long *, std::vector<long, std::allocator<long> > >, square_root<long> >' requested here | |
std::transform(s1.begin(), s1.end(), s2.begin(), s3.begin(), op); | |
^ |
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
#include <algorithm> | |
#include <iostream> | |
#include <sgl/sgl.h> | |
#include <string> | |
#include <vector> | |
template <typename T> | |
void print_status(const char* name, const T& x, bool v) { | |
if (v) { |
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
Applying operation 100000000 times (sequence length 1000 by 100000 iterations) at: Wed May 29 13:28:12 2019 | |
type plus fplus times norm cnvrt div sqrt pow | |
vector<int8_t> 0.04 1.19 0.09 0.11 1.07 2.34 1.71 18.91 | |
vector<int16_t> 0.06 1.16 0.06 0.08 1.00 2.38 1.74 18.91 | |
vector<int32_t> 0.12 1.48 0.26 0.43 0.51 2.30 1.75 18.98 | |
vector<int64_t> 0.25 1.23 0.50 0.66 0.80 8.08 1.77 18.94 | |
vector<float> 0.12 1.49 0.12 0.16 0.11 0.89 2.24 20.63 | |
vector<double> 0.22 1.15 0.23 0.30 0.23 1.20 1.93 20.29 | |
deque<int8_t> 0.75 1.47 0.73 1.26 1.48 3.57 1.83 20.54 | |
deque<int16_t> 0.76 1.46 0.77 0.97 1.49 2.71 2.01 20.70 |
NewerOlder