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
from pysubs2 import * | |
import sys | |
def main(argv=sys.argv): | |
if len(argv) <= 2: | |
print("Usage: python subtitle-glue.py output-file input-files") | |
return | |
subs = SSAFile() |
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
/// @example reflexpr/enum_to_string.cpp | |
/// | |
/// Copyright Matus Chochlik. | |
/// Distributed under the Boost Software License, Version 1.0. | |
/// See accompanying file LICENSE_1_0.txt or copy at | |
/// http://www.boost.org/LICENSE_1_0.txt | |
/// | |
#include <experimental/reflect> | |
#include <iostream> | |
#include <string_view> |
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
// 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; |
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
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 |
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
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 |
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
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% | |
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
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) |
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
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) |
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 <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++) { |
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 <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 |
NewerOlder