Skip to content

Instantly share code, notes, and snippets.

🍪

Evgeny Shulgin Izaron

🍪
Block or report user

Report or block Izaron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View benchmark.cpp
// Compile me! Using:
// g++ benchmark.cpp -std=c++11 -lbenchmark -lpthread -O2 -o benchmark
#include <benchmark/benchmark.h>
#include <boost/dynamic_bitset.hpp>
template <typename Bitset> Bitset GenerateBitset(size_t size) {
Bitset bs(size);
for (size_t i = 0; i < size; ++i)
bs.set(i, (rand() % 2) == 0);
return bs;
View bench_new
2018-09-02 01:41:11
Running ./benchmark
Run on (2 X 1400 MHz CPU s)
CPU Caches:
L1 Data 32K (x2)
L1 Instruction 32K (x2)
L2 Unified 1024K (x1)
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
-----------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
View bench_old
2018-09-02 01:36:23
Running ./benchmark
Run on (2 X 1400 MHz CPU s)
CPU Caches:
L1 Data 32K (x2)
L1 Instruction 32K (x2)
L2 Unified 1024K (x1)
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
-----------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
View bench
WORKING WITH bit_count
THE TYPE IS unsigned char
Check correctness...
The fast realization is correct!
Measuring time...
Naive solution runned 0.353572 seconds
Fast solution runned 0.0445373 seconds
The fast solution relative speed: 12.5964%
View After
Compiler: GNU C++ version 6.3.0 20170516
Std lib : GNU libstdc++ version 20170516
Boost v.: 1.68.0
Timings for dynamic_bitset<unsigned char> [3000000 iterations]
--------------------------------------------------
Elapsed: 18.9194
(total count: 31722432)
View Before
Compiler: GNU C++ version 6.3.0 20170516
Std lib : GNU libstdc++ version 20170516
Boost v.: 1.68.0
Timings for dynamic_bitset<unsigned char> [3000000 iterations]
--------------------------------------------------
Elapsed: 19.5219
(total count: 31722432)
@Izaron
Izaron / test.cpp
Created Aug 22, 2018
Measure the running time with `time ./test` on Linux
View test.cpp
#include <iostream>
#include <boost/dynamic_bitset.hpp>
int maxn = 1e8;
int bits = 100;
void test1() {
boost::dynamic_bitset<> bs(bits, abs(rand()));
int a = 0;
for (int i = 0; i < maxn; i++) {
View main.cpp
#include <bits/stdc++.h>
using namespace std;
vector<string> crop(string& s) {
vector<string> vec;
string cur = "";
for (int i = 0; i < (int) s.size(); i++) {
if (s[i] < 'a' || s[i] > 'z') {
// if s[i] is not a lowercase english letter
View cppan.yml
local_settings:
build_shared_libs: true
silent: false
build:
generator: Visual Studio 12 2013
toolset: v120_xp
View 2.txt
Microsoft (R) Build Engine версии 14.0.25420.1
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.
Сборка начата 20.12.2016 17:11:25.
Проект "D:\tesserac\win32\ALL_BUILD.vcxproj" в узле 1 (целевые объекты по умолчанию).
Проект "D:\tesserac\win32\ALL_BUILD.vcxproj" (1) выполняет сборку "D:\tesserac\win32\ZERO_CHECK.vcxproj" (2) в узле 1 (целевые объекты по умолчанию).
InitializeBuildStatus:
Создание "Win32\Release\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild", так как было задано "AlwaysCreate".
CustomBuild:
Для всех выходных данных обновления не требуется.
You can’t perform that action at this time.