Skip to content

Commit

Permalink
Fortran and Pascal
Browse files Browse the repository at this point in the history
  • Loading branch information
jabbalaci committed Jul 28, 2022
1 parent 875bc50 commit 2d96dfc
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 8 deletions.
53 changes: 49 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ Münchausen number is less than 440 million.

Dates are in `yyyy-mm-dd` format.

**2022-05-02:** Odin code was added.

**2022-05-02:** Elixir code was added.
**2022-07-28:** Fortran and Pascal codes were added.

## Implementations

Expand All @@ -39,7 +37,20 @@ using Linux. Execution times are wall-clock times and they are measured with
[hyperfine](https://github.com/sharkdp/hyperfine) (warmup runs: 2, benchmarked runs: 3).

The following implementations were received in the form of pull requests:
D, FASM, Haskell, Lua, NASM, Racket, JavaScript, V, Zig. Thanks for the contributions!

- D
- FASM
- Fortran
- Haskell
- Lua
- NASM
- Pascal
- Racket
- JavaScript
- V
- Zig

Thanks for the contributions!

If you know how to make something faster, let me know!

Expand Down Expand Up @@ -175,6 +186,22 @@ See https://en.wikipedia.org/wiki/FASM for more info about FASM.
[see source](fasm)


### Fortran

* GNU Fortran (GCC) 12.1.0
* Benchmark date: 2022-07-28 [yyyy-mm-dd]

| Compilation | Runtime (sec) | EXE (bytes) | stripped EXE (bytes) |
|-----|:---:|:---:|:---:|
| `gfortran -O2 main.f08 -o main` | ??? | 21,016 | 14,456 |

Note: I got a new (faster) computer and I'll have to re-do
all the tests on this machine. When it's done, the runtime will be shown.
However, I can say that it was very fast.

[see source](fortran)


### Go

* go version go1.17.1 linux/amd64
Expand Down Expand Up @@ -388,6 +415,24 @@ Note: good performance, though a bit slower than C.
[see source](odin)


### Pascal

* Free Pascal Compiler version 3.2.2 [2022/03/02] for x86_64
* Benchmark date: 2022-07-28 [yyyy-mm-dd]

| Compilation | Runtime (sec) | EXE (bytes) | stripped EXE (bytes) |
|-----|:---:|:---:|:---:|
| `fpc -O3 main.pas` | ??? | 531,024 | 531,024 |

Note #1: I got a new (faster) computer and I'll have to re-do
all the tests on this machine. When it's done, the runtime will be shown.
However, I can say that it was not very fast.

Note #2: Strangely, `strip` didn't make the EXE smaller.

[see source](pascal)


### Python 3

* Python 3.10.4
Expand Down
11 changes: 11 additions & 0 deletions _automation/fortran.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"section_name": "Fortran",
"compilers": ["gfortran"],
"output_file": "main",
"table_headers": [
"Compilation",
"Runtime (sec)",
"EXE (bytes)",
"stripped EXE (bytes)"
]
}
4 changes: 2 additions & 2 deletions _automation/lib/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
def get_version_string(name):
if name in ("gcc", "g++", "clang", "clang++", "dmd", "gdc",
"mypyc", "nim", "rustc", "python3", "dart", "ghc", "julia",
"nasm", "racket"):
"nasm", "racket", "gfortran"):
cmd = f"{name} --version"
return get_simple_cmd_output_lines(cmd)[0].strip()
if name == "ldc2":
Expand All @@ -19,7 +19,7 @@ def get_version_string(name):
if name in ("go", "odin"):
cmd = f"{name} version"
return get_simple_cmd_output_lines(cmd)[0]
if name in ("lua", "luajit"):
if name in ("lua", "luajit", "fpc"):
cmd = f"{name} -v"
return get_simple_cmd_output_lines(cmd)[0]
if name == "elixir":
Expand Down
11 changes: 11 additions & 0 deletions _automation/pascal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"section_name": "Pascal",
"compilers": ["fpc"],
"output_file": "main",
"table_headers": [
"Compilation",
"Runtime (sec)",
"EXE (bytes)",
"stripped EXE (bytes)"
]
}
8 changes: 7 additions & 1 deletion fortran/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
build:
v1:
gfortran -O2 main.f08 -o main

strip:
strip -s main

clean:
rm main
9 changes: 8 additions & 1 deletion pascal/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
build:
v1:
fpc -O3 main.pas

strip:
strip -s main

clean:
rm main

0 comments on commit 2d96dfc

Please sign in to comment.