Skip to content

nasccped/aoc-impl-comparison

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aoc-impl-comparison

Advent of Code implement comparison. This repo aims to expose the complexity diff when trying to implement the same solution for distinct programming languages.

The aoc-2020 was chosen for this challenge. I won't solve the entire edition, but just the initial days, instead...

fun image

illustrative image: how many lines cost for day 1 solve (the C is hiding a lot of impl code (~301 lines from aoc_utils))

As programming languages, Python and C was chosen since they're the most level-gap1 languages I know.

Requirements

To run and build this program, you'll need:

  • git
  • gcc2
  • python interpreter

You can also use the Makefile and wincbuild.bat provided to fast-(build|run) the program.

Usage

  • clone + change directory
git clone https://github.com/nasccped/aoc-impl-comparison
cd aoc-impl-comparison

C code

  • compile
mkdir -p out
gcc -o out/main.exe $(find c -type f -name *.c)
  • run
out/main # for normal run
out/main test # for test run

Warning

At WindowsOS, you'll may need to use a ./ (dot) before the executable path.

Python code

  • run
# for normal run
./out/main
# for test run
# ./out/main test

Using the Makefile

You can use the Makefile to handle sources and bins.

make # this will print a help panel

Important

make cbuild recipe doesn't works well in Windows. Use ./wincbuild.bat instead.

Footnotes

  1. level-gap: the level distance (high-level | low-level) between languages ↩

  2. GCC (GNU Compiler Collection) is a collection of compilers that transforms human-readable source code into machine-readable executable code. ↩

About

🧮 Advent of Code (2020) implementation comparison between high level abstracted language (Python) with a low level one (C)

Topics

Resources

License

Stars

Watchers

Forks

Contributors