Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/benchmark_on_change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 2

- name: Pull Docker image
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "c-plus-plus/lib/regex-boost"]
path = c-plus-plus/lib/regex-boost
url = https://github.com/boostorg/regex.git
[submodule "c-plus-plus/lib/regex-hyperscan"]
path = c-plus-plus/lib/regex-hyperscan
url = https://github.com/intel/hyperscan
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN apt update \
curl \
wget \
libc6 \
ragel \
unzip \
gnulib \
gnupg2 \
Expand All @@ -24,6 +25,7 @@ RUN apt update \
build-essential \
ca-certificates \
libreadline-dev \
libboost-all-dev \
apt-transport-https \
software-properties-common

Expand Down
2 changes: 1 addition & 1 deletion benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def writeResultsMarkdown(results):
conf = loadConfiguration(configurationFilename)

for run in conf['runs']:
if run['script']['title'] not in scripts and '*' not in scripts:
if run['script']['title'] not in scripts and run['script']['file'] not in scripts and '*' not in scripts:
continue

split = run['command']['command'].split()
Expand Down
10 changes: 8 additions & 2 deletions c-plus-plus/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
*/*
!**.cpp
# Ignore everything in any subdirectory
**/*

# Un-ignore all directories
!*/

# Un-ignore .cpp files
!**/*.cpp
38 changes: 21 additions & 17 deletions c-plus-plus/Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
CXXFLAGS = --std=c++17 -flto -s
CXXFLAGS += -Wall -fPIC -std=c++17 -O3
INCLUDES += -Ilib/regex-boost/include -Ilib/regex-hyperscan/src -Ilib/regex-hyperscan/bin -Ilib/regex-hyperscan/bin/lib/libhs.a
OBJECTS +=
LDFLAGS += -lstdc++ -lpthread

SCRIPTS = $(wildcard **/*.cpp)
SCRIPTS = $(wildcard ./src/*/*.cpp)

BINARIES = $(SCRIPTS:%.cpp=%-clang) \
$(SCRIPTS:%.cpp=%-clang-static) \
$(SCRIPTS:%.cpp=%-gcc) \
$(SCRIPTS:%.cpp=%-gcc-static) \
# $(SCRIPTS:%.cpp=%-graalvm) \
# $(SCRIPTS:%.cpp=%-graalvm-static) \


%-clang: %.cpp
clang++ -O3 $(CXXFLAGS) -o $@ $<
clang++ $(CXXFLAGS) $(INCLUDES) -o $@ $< $(LDFLAGS)

%-clang-static: %.cpp
clang++ -O3 $(CXXFLAGS) -static -o $@ $<
clang++ $(CXXFLAGS) $(INCLUDES) -static -o $@ $< $(LDFLAGS)

%-gcc : %.cpp
g++ -O3 $(CXXFLAGS) -o $@ $<
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $< $(LDFLAGS)

%-gcc-static : %.cpp
g++ -O3 $(CXXFLAGS) -static -o $@ $<

%-graalvm : %.cpp
$${GRAALVM_LLVM_TOOLCHAIN}/clang++ -O3 $(CXXFLAGS) -o $@ $<
g++ $(CXXFLAGS) $(INCLUDES) -static -o $@ $< $(LDFLAGS)

%-graalvm-static : %.cpp
$${GRAALVM_LLVM_TOOLCHAIN}/clang++ -O3 $(CXXFLAGS) -static -o $@ $<
all: libraries $(BINARIES)

all: $(BINARIES)
libraries:
cd ./lib/regex-boost && mkdir -p bin && cd bin && cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON .. && cmake --build .;
cd ./lib/regex-hyperscan && mkdir -p bin && cd bin && cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON .. && cmake --build .;

.PHONY: clean
clean:
rm -f $(BINARIES)
rm -f $(BINARIES)
cd ./lib/regex-boost && rm -rf bin;
cd ./lib/regex-hyperscan && rm -rf bin;

list:
@echo $(BINARIES)

.PHONY: clean list all libraries
19 changes: 13 additions & 6 deletions c-plus-plus/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@ strategy:
# command: 'graalvm.lli %s-graalvm'

files:
- primes/Simple
- primes/Atkin
- title: 'primes/Simple'
file: 'src/primes/Simple'

- collatz/MaxSequence
- title: 'primes/Atkin'
file: 'src/primes/Atkin'

- mandelbrot/Simple
- title: 'collatz/MaxSequence'
file: 'src/collatz/MaxSequence'

- treap/Naive
- title: 'mandelbrot/Simple'
file: 'src/mandelbrot/Simple'

- recursion/Tak
- title: 'treap/Naive'
file: 'src/treap/Naive'

- title: 'recursion/Tak'
file: 'src/recursion/Tak'

exclude:
- command: 'gcc'
Expand Down
1 change: 1 addition & 0 deletions c-plus-plus/lib/regex-boost
Submodule regex-boost added at cb5591
1 change: 1 addition & 0 deletions c-plus-plus/lib/regex-hyperscan
Submodule regex-hyperscan added at bc3b19
File renamed without changes.
File renamed without changes.
File renamed without changes.
62 changes: 62 additions & 0 deletions c-plus-plus/src/regexp/boost.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include <iostream>
#include <string>
#include <chrono>
#include <vector>
#include <fstream>
#include <filesystem>
#include <boost/regex.hpp>

const size_t N_REGEX_ITERATIONS = 1000;
const size_t N_CHUNKS_ITERATIONS = 10;

const std::vector<boost::regex> regexps = {
boost::regex("[Hh]ello [Ww]orld[!]?"),
boost::regex("[Hh]ello [Ww]orld[!]?$"),
boost::regex("[0-9][0-9][0-9][0-9][0-9]"),
boost::regex("[0-9][0-9][0-9][0-9][0-9]$"),
boost::regex("[CV]V[a-z]askjdvc[a-z0-9A-Z]"),
boost::regex("^[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]\\s[a-zA-Z]"),
boost::regex("^z.*$"),
boost::regex("^z.z.z.z.z.z.z.z.z.z.z.z.z.z*$"),
boost::regex("^[z][z][z][z][z][z][z][z][z][z][z][z][z][z][z]\\S*$"),
boost::regex("^[az]\\S\\D*$"),
};

const std::vector<std::string> chunks = {
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"10.10.10.10 cjdhjhsdclkjhasl dflaskijd flkzsjd vlkszJ cvlsJKHD CVlaskjdvcl sdjvl ksDJv lkj lkj lzkjsdf lkj lzskdjv lkzj 66678",
"hello world !",
"bar!234ahem.. 'hello world !' ..c !hello worldzzz !zzzzzzzzzzzzzzzzzzz ksajf 874r hbsdfk i7r kjasdhf ikasuwhfia7234 kwaejhfkawehf7234h zzzzzzzzzzzzzzzzzzzzzzzzz dsssssssssssssssssssssssssssssssssssssssss aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ssssssssssssssssssssssssssssssssssssssss ddddddddddddddddddddddddddddddddddddddddddddddddd ffffffffffffffffffffffffffffffffffffffffffff ggggggggggggggggggggggggggggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk llllllllllllllllllllllllllllllllllllllllllllllllllll qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppiauwdhfl,asdnfliehjrsgoirtjoersahjrouh waei7yi7q34f kwejfg hello world",
"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",
};

int main(int argc, char *argv[])
{
const auto start_time = std::chrono::high_resolution_clock::now();

for (size_t i = 0; i < N_REGEX_ITERATIONS; i++)
{
for (const auto &re : regexps)
{
for (size_t j = 0; j < N_CHUNKS_ITERATIONS; j++)
{
for (auto chunk : chunks)
{
for (boost::smatch sm; boost::regex_search(chunk, sm, re);)
{
// std::cout << sm.str() << std::endl;
chunk = sm.suffix().str();
}
}
}
}
}


const auto end_time = std::chrono::high_resolution_clock::now();
const auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time).count();

std::cout << "Execution time: " << duration << "ms" << std::endl;

return 0;
}
95 changes: 95 additions & 0 deletions c-plus-plus/src/regexp/hyperscan.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#include <iostream>
#include <string>
#include <chrono>
#include <vector>
#include <fstream>
#include <filesystem>
#include "hs.h"
#include "database.h"
#include "scratch.h"

const size_t N_REGEX_ITERATIONS = 1000;
const size_t N_CHUNKS_ITERATIONS = 10;

const std::vector<std::string> rules = {
std::string("[Hh]ello [Ww]orld[!]?"),
std::string("[Hh]ello [Ww]orld[!]?$"),
std::string("[0-9][0-9][0-9][0-9][0-9]"),
std::string("[0-9][0-9][0-9][0-9][0-9]$"),
std::string("[CV]V[a-z]askjdvc[a-z0-9A-Z]"),
std::string("^[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]\\s[a-zA-Z]"),
std::string("^z.*$"),
std::string("^z.z.z.z.z.z.z.z.z.z.z.z.z.z*$"),
std::string("^[z][z][z][z][z][z][z][z][z][z][z][z][z][z][z]\\S*$"),
std::string("^[az]\\S\\D*$"),
};

std::vector<std::tuple<hs_database_t*, hs_scratch_t*>> regexps;

const std::vector<std::string> chunks = {
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"10.10.10.10 cjdhjhsdclkjhasl dflaskijd flkzsjd vlkszJ cvlsJKHD CVlaskjdvcl sdjvl ksDJv lkj lkj lzkjsdf lkj lzskdjv lkzj 66678",
"hello world !",
"bar!234ahem.. 'hello world !' ..c !hello worldzzz !zzzzzzzzzzzzzzzzzzz ksajf 874r hbsdfk i7r kjasdhf ikasuwhfia7234 kwaejhfkawehf7234h zzzzzzzzzzzzzzzzzzzzzzzzz dsssssssssssssssssssssssssssssssssssssssss aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ssssssssssssssssssssssssssssssssssssssss ddddddddddddddddddddddddddddddddddddddddddddddddd ffffffffffffffffffffffffffffffffffffffffffff ggggggggggggggggggggggggggggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk llllllllllllllllllllllllllllllllllllllllllllllllllll qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppiauwdhfl,asdnfliehjrsgoirtjoersahjrouh waei7yi7q34f kwejfg hello world",
"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",
};

int main(int argc, char *argv[])
{
regexps.resize(rules.size());

for (size_t i = 0; i < rules.size(); i++)
{
hs_compile_error_t *compile_err;
hs_database_t *db;
hs_scratch_t *scratch;

hs_error_t err = hs_compile(rules[i].c_str(), HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH, HS_MODE_BLOCK, NULL, &db, &compile_err);
if (err != HS_SUCCESS)
{
std::cerr << "ERROR: Unable to compile pattern \"" << rules[i] << "\": " << compile_err->message << std::endl;
hs_free_compile_error(compile_err);
return -1;
}

err = hs_alloc_scratch(db, &scratch);
if (err != HS_SUCCESS)
{
std::cerr << "ERROR: Unable to allocate scratch space. Exiting." << std::endl;
hs_free_database(db);
return -1;
}

regexps[i] = std::make_tuple(db, scratch);
}

const auto start_time = std::chrono::high_resolution_clock::now();

for (size_t i = 0; i < N_REGEX_ITERATIONS; i++)
{
for (const auto &re : regexps)
{
for (size_t j = 0; j < N_CHUNKS_ITERATIONS; j++)
{
for (auto chunk : chunks)
{
hs_error_t err = hs_scan(static_cast<hs_database_t*>(std::get<0>(re)), chunk.c_str(), chunk.size(), 0, static_cast<hs_scratch_t*>(std::get<1>(re)), [](unsigned int id, unsigned long long from, unsigned long long to, unsigned int flags, void *ctx) -> int {
return 0;
}, nullptr);
if (err != HS_SUCCESS)
{
std::cerr << "ERROR: Unable to scan chunk. Exiting." << std::endl;
return -1;
}
}
}
}
}

const auto end_time = std::chrono::high_resolution_clock::now();
const auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time).count();

std::cout << "Execution time: " << duration << "ms" << std::endl;

return 0;
}
63 changes: 63 additions & 0 deletions c-plus-plus/src/regexp/stdlib.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include <iostream>
#include <string>
#include <chrono>
#include <vector>
#include <regex>
#include <fstream>
#include <filesystem>

const size_t N_REGEX_ITERATIONS = 1000;
const size_t N_CHUNKS_ITERATIONS = 10;

// array of regexs
const std::vector<std::regex> regexps = {
std::regex("[Hh]ello [Ww]orld[!]?"),
std::regex("[Hh]ello [Ww]orld[!]?$"),
std::regex("[0-9][0-9][0-9][0-9][0-9]"),
std::regex("[0-9][0-9][0-9][0-9][0-9]$"),
std::regex("[CV]V[a-z]askjdvc[a-z0-9A-Z]"),
std::regex("^[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]\\s[a-zA-Z]"),
std::regex("^z.*$"),
std::regex("^z.z.z.z.z.z.z.z.z.z.z.z.z.z*$"),
std::regex("^[z][z][z][z][z][z][z][z][z][z][z][z][z][z][z]\\S*$"),
std::regex("^[az]\\S\\D*$"),
};

const std::vector<std::string> chunks = {
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"10.10.10.10 cjdhjhsdclkjhasl dflaskijd flkzsjd vlkszJ cvlsJKHD CVlaskjdvcl sdjvl ksDJv lkj lkj lzkjsdf lkj lzskdjv lkzj 66678",
"hello world !",
"bar!234ahem.. 'hello world !' ..c !hello worldzzz !zzzzzzzzzzzzzzzzzzz ksajf 874r hbsdfk i7r kjasdhf ikasuwhfia7234 kwaejhfkawehf7234h zzzzzzzzzzzzzzzzzzzzzzzzz dsssssssssssssssssssssssssssssssssssssssss aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ssssssssssssssssssssssssssssssssssssssss ddddddddddddddddddddddddddddddddddddddddddddddddd ffffffffffffffffffffffffffffffffffffffffffff ggggggggggggggggggggggggggggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk llllllllllllllllllllllllllllllllllllllllllllllllllll qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppiauwdhfl,asdnfliehjrsgoirtjoersahjrouh waei7yi7q34f kwejfg hello world",
"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",
};

int main(int argc, char *argv[])
{
const auto start_time = std::chrono::high_resolution_clock::now();

for (size_t i = 0; i < N_REGEX_ITERATIONS; i++)
{
for (const auto &re : regexps)
{
for (size_t j = 0; j < N_CHUNKS_ITERATIONS; j++)
{
for (auto chunk : chunks)
{
for (std::smatch sm; std::regex_search(chunk, sm, re);)
{
// std::cout << sm.str() << std::endl;
chunk = sm.suffix().str();
}
}
}
}
}


const auto end_time = std::chrono::high_resolution_clock::now();
const auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time).count();

std::cout << "Execution time: " << duration << "ms" << std::endl;

return 0;
}
File renamed without changes.
4 changes: 2 additions & 2 deletions run_on_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
# Parsing changed files to find unique language-script pairs
benchmark_commands = set()
for file_path in changed_files:
parts = file_path.split('/')
parts = file_path.split('/', 2)
if len(parts) < 3:
continue # Skip invalid paths
language, category, script = parts[0], parts[1], parts[2]
script_name = script.split('.')[0] # Extract script name without extension
# Assuming the benchmark script supports language and script parameters
command = f"python3 ./benchmark.py --languages {language} --scripts {category}/{script_name} --times 1"
command = f"python3 ./benchmark.py run --languages {language} --scripts {category}/{script_name} --times 1"
benchmark_commands.add(command)

# Executing benchmark commands
Expand Down