Skip to content

Commit

Permalink
Restructure benchmark layout (prepare to add new benchmarks).
Browse files Browse the repository at this point in the history
Update pre-generated benchmark files (trivial line directive changes).

Disable regeneration of Kleenex files, as Kleenex is not actively maintained and
fails to build with the recent cabal and Haskell ecosystem.
  • Loading branch information
skvadrik committed Dec 4, 2024
1 parent e5cb9a1 commit 3ebf875
Show file tree
Hide file tree
Showing 475 changed files with 90,813 additions and 50,452 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,20 @@ jobs:
run: cmake --build .build

- name: Run submatch DFA AOT benchmark
working-directory: .build/benchmarks/submatch_dfa_aot
working-directory: .build/benchmarks/c/submatch
run: |
./run.py --quickverify \
&& ./run.py --repetitions 5 --output results.json \
&& cat results.json
- name: Run submatch DFA JIT benchmark
working-directory: .build/benchmarks/submatch_dfa_jit
run: ./bench_submatch_dfa_jit
working-directory: .build/benchmarks/c/submatch_libre2c/jit
run: ./bench_submatch_jit

- name: Run submatch Java benchmark (ReTdfa)
working-directory: .build/benchmarks/submatch_java
working-directory: .build/benchmarks/c/submatch_libre2c/java
run: ./run.py

- name: Run submatch NFA benchmark
working-directory: .build/benchmarks/submatch_nfa
working-directory: .build/benchmarks/c/submatch_libre2c/nfa
run: ./bench_submatch_nfa
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "benchmarks/submatch_java/REgen"]
path = benchmarks/submatch_java/REgen
[submodule "benchmarks/c/submatch_libre2c/java/REgen"]
path = benchmarks/c/submatch_libre2c/java/REgen
url = https://github.com/skvadrik/REgen.git
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,9 @@ if (RE2C_BUILD_LIBS)
endif()

if(RE2C_BUILD_BENCHMARKS)
add_subdirectory(benchmarks/submatch_nfa)
add_subdirectory(benchmarks/submatch_dfa_jit)
add_subdirectory(benchmarks/submatch_java)
add_subdirectory(benchmarks/c/submatch_libre2c/nfa)
add_subdirectory(benchmarks/c/submatch_libre2c/jit)
add_subdirectory(benchmarks/c/submatch_libre2c/java)
endif()
else()
# empty check target
Expand All @@ -645,7 +645,7 @@ else()
endif()

if(RE2C_BUILD_BENCHMARKS)
add_subdirectory(benchmarks/submatch_dfa_aot)
add_subdirectory(benchmarks/c/submatch)
endif()

if(RE2C_BUILD_TESTS)
Expand Down
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,8 @@ TESTS = \

# benchmarks
if WITH_BENCHMARKS
SUBDIRS += benchmarks/submatch_dfa_aot
EXTRA_DIST += benchmarks/submatch_dfa_aot
SUBDIRS += benchmarks/c/submatch
EXTRA_DIST += benchmarks/c
endif

# libre2c
Expand Down
12 changes: 6 additions & 6 deletions Makefile.lib.am
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ check_PROGRAMS += test_libre2c

# benchmarks
if WITH_BENCHMARKS
SUBDIRS += benchmarks/submatch_nfa
SUBDIRS += benchmarks/submatch_dfa_jit
EXTRA_DIST += benchmarks/submatch_nfa
EXTRA_DIST += benchmarks/submatch_dfa_jit
SUBDIRS += benchmarks/c/submatch_libre2c/nfa
SUBDIRS += benchmarks/c/submatch_libre2c/jit
EXTRA_DIST += benchmarks/c/submatch_libre2c/nfa
EXTRA_DIST += benchmarks/c/submatch_libre2c/jit
if WITH_JAVA
SUBDIRS += benchmarks/submatch_java
EXTRA_DIST += benchmarks/submatch_java
SUBDIRS += benchmarks/c/submatch_libre2c/java
EXTRA_DIST += benchmarks/c/submatch_libre2c/java
endif # WITH_JAVA
endif # WITH_BENCHMARKS
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <string.h>

#include "benchmarks/common/common.h"
#include "benchmarks/c/common/common.h"
#include "lib/regex.h"

#ifdef HAVE_RE2_RE2_H
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ file(MAKE_DIRECTORY "${GEN_DIR}/kleenex/")
set(KLEENEX "${ENG_DIR}/kleenex/kexc")
add_custom_command(
OUTPUT "${KLEENEX}"
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/engines/kleenex/getkleenex.sh"
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/../engines/kleenex/getkleenex.sh"
WORKING_DIRECTORY "${ENG_DIR}/kleenex/"
)
# Masked benchmarks for which Kleenex either generates very large output
Expand All @@ -71,23 +71,24 @@ foreach(bench ${KLEENEX_BENCHMARKS})
set(src_file "${SRC_DIR}/kleenex/${bench}.kex")
set(gen_file "${GEN_DIR}/kleenex/${bench}.c")
set(pregen_file "${PREGEN_DIR}/kleenex/${bench}.c")
# optionally regenerate kleenex benchmarks if RE2C_REGEN_BENCHMARKS is set
if(RE2C_REGEN_BENCHMARKS)
file(RELATIVE_PATH rel_src_file "${CMAKE_CURRENT_BINARY_DIR}" "${src_file}")
file(RELATIVE_PATH rel_gen_file "${CMAKE_CURRENT_BINARY_DIR}" "${gen_file}")
add_custom_command(
OUTPUT "${gen_file}"
COMMAND "${KLEENEX}" compile "${rel_src_file}" --srcout "${rel_gen_file}" --act=false --la=true
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${gen_file}" "${pregen_file}"
DEPENDS "${src_file}" "${KLEENEX}"
)
else()
# don't regenerate kleenex benchmarks, as kleenex is not actively developed
# and it cannot be built with the recent cabal / haskell ecosystem
# if(RE2C_REGEN_BENCHMARKS)
# file(RELATIVE_PATH rel_src_file "${CMAKE_CURRENT_BINARY_DIR}" "${src_file}")
# file(RELATIVE_PATH rel_gen_file "${CMAKE_CURRENT_BINARY_DIR}" "${gen_file}")
# add_custom_command(
# OUTPUT "${gen_file}"
# COMMAND "${KLEENEX}" compile "${rel_src_file}" --srcout "${rel_gen_file}" --act=false --la=true
# COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${gen_file}" "${pregen_file}"
# DEPENDS "${src_file}" "${KLEENEX}"
# )
# else()
add_custom_command(
OUTPUT "${gen_file}"
COMMAND "${CMAKE_COMMAND}" -E copy "${pregen_file}" "${gen_file}"
DEPENDS "${pregen_file}"
)
endif()
# endif()
list(APPEND GEN "${gen_file}")
endforeach()

Expand All @@ -97,7 +98,7 @@ file(MAKE_DIRECTORY "${GEN_DIR}/ragel/")
set(RAGEL "${ENG_DIR}/ragel/ragel7")
add_custom_command(
OUTPUT "${RAGEL}"
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/engines/ragel/getragel7.sh"
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/../engines/ragel/getragel7.sh"
WORKING_DIRECTORY "${ENG_DIR}/ragel/"
)
foreach(bench ${BENCHMARKS})
Expand Down Expand Up @@ -131,7 +132,7 @@ set(RE2C "${CMAKE_BINARY_DIR}/re2c")
set(RE2C3 "${ENG_DIR}/re2c/re2c3")
add_custom_command(
OUTPUT "${RE2C3}"
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/engines/re2c/getre2c3.sh"
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/../engines/re2c/getre2c3.sh"
WORKING_DIRECTORY "${ENG_DIR}/re2c/"
)
set(RE2C_FLAGS "--reusable" "--tags" "--no-generation-date" "--no-version")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ $(GEN_RE2C_EOF_TDFA1): $(GEN_DIR)/%-eof-tdfa1.c: $(SRC_DIR)/%.re $(COMMON_RE2C)
$(AM_V_GEN)$(RE2C) $(RE2C_FLAGS_EOF) $< -o $@
$(AM_V_at)if ! cmp -s $@ $(PREGEN_DIR)/re2c/$(@F) ; then cp -f $@ $(PREGEN_DIR)/re2c/$(@F) ; fi


# optionally regenerate ragel, kleenex and re2c-3.0 benchmarks
# (TDFA(0) and staDFA algorithms were removed in re2c versions after 3.0)

Expand Down Expand Up @@ -158,10 +159,15 @@ $(GEN_RAGEL): $(GEN_DIR)/%.c: $(SRC_DIR)/%.rl $(COMMON_RAGEL) $(RAGEL)
$(AM_V_GEN)$(RAGEL) -G2 $< -o $@
$(AM_V_at)if ! cmp -s $@ $(PREGEN_DIR)/ragel/$(@F) ; then cp -f $@ $(PREGEN_DIR)/ragel/$(@F) ; fi

$(GEN_KLEENEX): $(GEN_DIR)/%.c: $(SRC_DIR)/%.kex $(KLEENEX)
# don't regenerate kleenex benchmarks, as kleenex is not actively developed
# and it cannot be built with the recent cabal / haskell ecosystem
# $(GEN_KLEENEX): $(GEN_DIR)/%.c: $(SRC_DIR)/%.kex $(KLEENEX)
# $(AM_V_at)mkdir -p $(@D)
# $(AM_V_GEN)$(KLEENEX) compile $< --srcout $@ --act=false --la=true
# $(AM_V_at)if ! cmp -s $@ $(PREGEN_DIR)/kleenex/$(@F) ; then cp -f $@ $(PREGEN_DIR)/kleenex/$(@F) ; fi
$(GEN_KLEENEX): $(GEN_DIR)/%: $(PREGEN_DIR)/%
$(AM_V_at)mkdir -p $(@D)
$(AM_V_GEN)$(KLEENEX) compile $< --srcout $@ --act=false --la=true
$(AM_V_at)if ! cmp -s $@ $(PREGEN_DIR)/kleenex/$(@F) ; then cp -f $@ $(PREGEN_DIR)/kleenex/$(@F) ; fi
$(AM_V_GEN)cp -f $< $@

else

Expand All @@ -186,15 +192,15 @@ $(DAT): $(DAT_DIR)/%/big: $(DAT_DIR)/%/small
$(AM_V_GEN)( cd $(@D) && ../../$(srcdir)/data/gen.py )

$(KLEENEX):
$(AM_V_at)mkdir -p $(@D) && cp $(srcdir)/engines/kleenex/getkleenex.sh $(@D)
$(AM_V_at)mkdir -p $(@D) && cp $(srcdir)/../engines/kleenex/getkleenex.sh $(@D)
$(AM_V_GEN)( cd $(@D) && ./getkleenex.sh )

$(RAGEL):
$(AM_V_at)mkdir -p $(@D) && cp $(srcdir)/engines/ragel/getragel7.sh $(@D)
$(AM_V_at)mkdir -p $(@D) && cp $(srcdir)/../engines/ragel/getragel7.sh $(@D)
$(AM_V_GEN)( cd $(@D) && ./getragel7.sh )

$(RE2C3):
$(AM_V_at)mkdir -p $(@D) && cp $(srcdir)/engines/re2c/getre2c3.sh $(@D)
$(AM_V_at)mkdir -p $(@D) && cp $(srcdir)/../engines/re2c/getre2c3.sh $(@D)
$(AM_V_GEN)( cd $(@D) && ./getre2c3.sh )

clean-local:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3ebf875

Please sign in to comment.