From 93b8d39394333c2169979b926119457689f194ca Mon Sep 17 00:00:00 2001 From: goksu <25721443+goeksu@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:06:45 +0300 Subject: [PATCH] Revert "files optimized" This reverts commit 0e87ae09a60ec6ef8da3504e31a5833df38dbe8c. --- src/tools/ftbench/Makefile | 19 ++----- .../fonts/{tool/subsetter.sh => sub.sh} | 0 src/tools/ftbench/ftbench.c | 2 +- src/tools/ftbench/{src => }/mlgetopt.h | 0 src/tools/ftbench/src/tohtml.py | 53 ------------------- 5 files changed, 6 insertions(+), 68 deletions(-) rename src/tools/ftbench/fonts/{tool/subsetter.sh => sub.sh} (100%) rename src/tools/ftbench/{src => }/mlgetopt.h (100%) delete mode 100644 src/tools/ftbench/src/tohtml.py diff --git a/src/tools/ftbench/Makefile b/src/tools/ftbench/Makefile index 2d84063f4..a8211ebd5 100644 --- a/src/tools/ftbench/Makefile +++ b/src/tools/ftbench/Makefile @@ -1,12 +1,10 @@ # Variables FTBENCH_SRC = ftbench.c -FTBENCH_BIN = bench +FTBENCH_BIN = bench.out FTBENCH_FLAGS = $(shell pkg-config --cflags freetype2) -lfreetype FONTS = $(wildcard fonts/*.ttf) BASELINES = $(addprefix baselines/, $(notdir $(FONTS))) BENCHMARKS = $(addprefix benchmarks/, $(notdir $(FONTS))) -PYTHON = python3 -HTMLCREATOR = src/tohtml.py # Default target all: $(FTBENCH_BIN) @@ -14,7 +12,6 @@ all: $(FTBENCH_BIN) # Build ftbench $(FTBENCH_BIN): $(FTBENCH_SRC) gcc $(FTBENCH_FLAGS) $(FTBENCH_SRC) -o $(FTBENCH_BIN) - @echo "Built." # Create directories for baselines and benchmarks baselines/ benchmarks/: @@ -26,7 +23,6 @@ baseline: $(FTBENCH_BIN) baselines/ $(foreach font, $(FONTS), \ ./$(FTBENCH_BIN) $(font) > baselines/$(notdir $(font)).txt; \ ) - @echo "baseline created" # Benchmark and compare to baseline .PHONY: benchmark @@ -34,16 +30,11 @@ benchmark: $(FTBENCH_BIN) benchmarks/ $(foreach font, $(FONTS), \ ./$(FTBENCH_BIN) $(font) > benchmarks/$(notdir $(font)).txt; \ ) - $(PYTHON) $(HTMLCREATOR) - @echo "benchmark created." - -.PHONY: page -page: benchmarks/ baselines/ - $(PYTHON) $(HTMLCREATOR) - @echo "HTML page of the benchmark created." + $(foreach font, $(FONTS), \ + diff baselines/$(notdir $(font)).txt benchmarks/$(notdir $(font)).txt; \ + ) .PHONY: clean clean: rm -f $(FTBENCH_BIN) - rm -rf baselines/ benchmarks/ *.html - @echo "cleaned." \ No newline at end of file + rm -rf baselines/ benchmarks/ diff --git a/src/tools/ftbench/fonts/tool/subsetter.sh b/src/tools/ftbench/fonts/sub.sh similarity index 100% rename from src/tools/ftbench/fonts/tool/subsetter.sh rename to src/tools/ftbench/fonts/sub.sh diff --git a/src/tools/ftbench/ftbench.c b/src/tools/ftbench/ftbench.c index 13cfd9b0d..2f0f2a4e6 100644 --- a/src/tools/ftbench/ftbench.c +++ b/src/tools/ftbench/ftbench.c @@ -40,7 +40,7 @@ #ifdef UNIX #include #else -#include "src/mlgetopt.h" +#include "mlgetopt.h" #endif #ifdef _WIN32 diff --git a/src/tools/ftbench/src/mlgetopt.h b/src/tools/ftbench/mlgetopt.h similarity index 100% rename from src/tools/ftbench/src/mlgetopt.h rename to src/tools/ftbench/mlgetopt.h diff --git a/src/tools/ftbench/src/tohtml.py b/src/tools/ftbench/src/tohtml.py deleted file mode 100644 index 0076acb92..000000000 --- a/src/tools/ftbench/src/tohtml.py +++ /dev/null @@ -1,53 +0,0 @@ -import os -import re - -# Create the HTML file -with open('benchmark_results.html', 'w') as f: - f.write('\n') - f.write('\n') - f.write('Benchmark Results\n') - f.write('\n') - f.write('\n') - f.write('

Benchmark Results

\n') - - # Traverse through the 'baselines' directory - for filename in os.listdir('baselines'): - baseline_filepath = os.path.join('baselines', filename) - benchmark_filepath = os.path.join('benchmarks', filename) - - # Process the baseline file - with open(baseline_filepath, 'r') as baseline_file: - baseline_lines = baseline_file.readlines() - - # Process the benchmark file - with open(benchmark_filepath, 'r') as benchmark_file: - benchmark_lines = benchmark_file.readlines() - - f.write(f'

Results for {filename}

\n') - f.write('\n') - f.write('\n') - - # For each line in the baseline and benchmark files - for baseline_line, benchmark_line in zip(baseline_lines, benchmark_lines): - # If the line starts with a space, it's a test result line - if baseline_line.startswith(' '): - # Extract the test name, the time per operation, and the number of operations done - baseline_match = re.match(r' (\w+(\s\(\w+\))?)\s+(\d+\.\d+)\s', baseline_line) - benchmark_match = re.match(r' (\w+(\s\(\w+\))?)\s+(\d+\.\d+)\s', benchmark_line) - - # If the line could be parsed - if baseline_match and benchmark_match: - # Check which value is higher - baseline_value = float(baseline_match.group(3)) - benchmark_value = float(benchmark_match.group(3)) - - # Write the test result to the HTML file - if baseline_value > benchmark_value: - f.write(f'\n') - else: - f.write(f'\n') - - f.write('
TestBaselineCurrent
{baseline_match.group(1)}{baseline_match.group(3)}{benchmark_match.group(3)}
{baseline_match.group(1)}{baseline_match.group(3)}{benchmark_match.group(3)}
\n') - - f.write('\n') - f.write('\n')