Skip to content

Increase push_swap_tester speed #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ed76a0e
Starting new multithreaded version
SimonCROS Jan 12, 2025
0eb69bc
New version beta should work
SimonCROS Jan 12, 2025
d4c239b
Add line on readme to redirect on GitHub
SimonCROS Jan 12, 2025
123ea49
Fix "--sorted" -> "-t"
SimonCROS Jan 12, 2025
4abf34b
Fix compilation on old compilers
SimonCROS Jan 13, 2025
f6f8f4e
Fix execution, file path
SimonCROS Jan 13, 2025
02392ed
Better line clear
SimonCROS Jan 13, 2025
3f6bdfc
Add seed functionality
SimonCROS Jan 18, 2025
e90225b
Add --json and --no-json options
SimonCROS Jan 18, 2025
e735459
Completely remove std::format to avoid duplicating the code :'(
SimonCROS Jan 18, 2025
76ebf1a
Fix possible duplicate number
SimonCROS Jan 18, 2025
49a0a12
Update date
SimonCROS Jan 18, 2025
326a5fd
Downgrade required C++ version to C++17
SimonCROS May 3, 2025
6686b0c
Separate stdout and stderr, count while reading, add timeout
SimonCROS May 3, 2025
51c920a
Sum while iterating
SimonCROS May 3, 2025
5907819
Reduce instruction count
SimonCROS May 3, 2025
82368c5
Generate unique numbers only once per thread
SimonCROS May 3, 2025
34f0fcb
Fix consistency using same seed
SimonCROS May 4, 2025
278adc6
Optimize allocator for unordered_set
SimonCROS May 4, 2025
3f289b1
Add max iteration count for numbers generation
SimonCROS May 4, 2025
2d712ea
Collect more info on process
SimonCROS May 4, 2025
54f740b
Simplify calculations
SimonCROS May 4, 2025
59cf299
Better print for collected stats
SimonCROS May 4, 2025
b77e6f0
Add timeout parameter
SimonCROS May 4, 2025
02c6048
Update help page
SimonCROS May 4, 2025
46d7fab
Fix fork monitoring on macos
SimonCROS May 4, 2025
81c7cc2
Smaller output
SimonCROS May 15, 2025
6c43f4e
Avoid counting killed executions as errors
SimonCROS May 18, 2025
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
70 changes: 0 additions & 70 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ push_swap
checker
checker_linux
checker_Mac
obj

# Prerequisites
*.d
Expand Down
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/dictionaries/project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

247 changes: 247 additions & 0 deletions .idea/editor.xml

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/push_swap_tester.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

83 changes: 0 additions & 83 deletions .vscode/settings.json

This file was deleted.

30 changes: 11 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ NAME := complexity

# Commands

override CPPC := clang++
override CPPFLAGS := -std=c++17 -Wall -Wextra
CXXFLAGS := -std=c++17 -Wall -Wextra -O3

# Sources

LANG := fr_FR

override SRCS := \
main.cpp \
exec.cpp \
args.cpp \
print.cpp \
utils.cpp \
lang/$(LANG).cpp \
print.cpp \
args.cpp \
executor.cpp \
arguments_generator.cpp \

override HEADERS := \
complexity.hpp \
executor.hpp \
arguments_generator.hpp \
thread_safe_random.hpp \

override HEADERS := $(addprefix includes/,$(HEADERS))
override HEADERS := $(addprefix src/,$(HEADERS))

override OBJS := $(addprefix obj/, $(SRCS:.cpp=.o))

Expand All @@ -32,24 +32,16 @@ override OBJDIRS := $(sort $(dir $(OBJS)))

all: $(NAME)

fr:
touch src/lang/fr_FR.cpp
$(MAKE) LANG="fr_FR"

en:
touch src/lang/en_GB.cpp
$(MAKE) LANG="en_GB"

obj/%.o: src/%.cpp $(HEADERS)
$(CPPC) $(CPPFLAGS) -c $< -o $@ -Iincludes
$(CXX) $(CXXFLAGS) -c $< -o $@ -Iincludes

$(OBJS): | $(OBJDIRS)

$(OBJDIRS):
mkdir -p $@

$(NAME): $(OBJS)
$(CPPC) $(CPPFLAGS) -o $@ $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $(OBJS)

clean:
rm -rf obj
Expand Down
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,38 @@

Compile with the following command

`make [fr|en]`
`make`

## Usage

**./complexity** \[**-vh**\] \[**-s** <ins>seed</ins>\] \[**-f** <ins>push_swap</ins>\] \[**--sorted**\] <ins>numbers</ins> <ins>iterations</ins> \[<ins>goal</ins>\] \[<ins>checker</ins>\]
> [!WARNING]
> This version is a beta version. Checker and `-o` are currently not available.\
> If you find a bug, please report it to this pull request: https://github.com/SimonCROS/push_swap_tester/pull/6.

L'exécutable push_swap est cherché par défaut dans le répertoire courant et parent.
**./complexity** \[**-vh**\] \[**-s** <ins>seed</ins>\] \[**-f** <ins>push_swap</ins>\] \[**-t** <ins>threads</ins>\] <ins>numbers</ins> <ins>iterations</ins> \[<ins>goal</ins>\] \[<ins>checker</ins>\]

Les options suivantes sont disponibles :
Following options are available :

**-v**, **--version**\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Affiche la version du testeur
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Show version of tester

**-h**, **--help**\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Affiche l'aide.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Show help

**--json**, **--no-json**\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Toggle JSON output on or off. By default, JSON output is enabled for non-TTY environments

**-s** <ins>seed</ins>, **--seed**=<ins>seed</ins>\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Génère les nombres en fonction de la graine.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Generates the numbers based on the seed

**-o** <ins>output</ins>, **--output**=<ins>output</ins>\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Spécifie un fichier de sortie pour les logs.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Specifies an output file for logs

**-f** <ins>push_swap</ins>, **--file**=<ins>push_swap</ins>\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utilise <ins>push_swap</ins> en tant qu'exécutable push_swap.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Use <ins>push_swap</ins> for push_swap executable

**--sorted**\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Envoie uniquement des nombres triés au programme.
**-t** <ins>threads</ins>, **--threads**=<ins>threads</ins>\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Specifies the amount of threads to use (default: 6)

### Demo :

Expand Down
60 changes: 0 additions & 60 deletions includes/complexity.hpp

This file was deleted.

8 changes: 0 additions & 8 deletions src/Makefile

This file was deleted.

Loading