Skip to content

Commit

Permalink
try out a custom tool for measuring memory
Browse files Browse the repository at this point in the history
  • Loading branch information
acheronfail committed Jan 15, 2024
1 parent fae1d35 commit fae1242
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 47 deletions.
80 changes: 42 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Do the thing in CI

on:
push:
branches: ['master']
branches: ['master', 'max_rss']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -14,39 +14,39 @@ jobs:
matrix:
# do the slow ones first, to make the overall build quicker
build:
# - 00 tcl
- 01 prolog
- 02 smalltalk
- 03 python3
- 04 julia
- 05 perl
- 06 cobol
- 07 haskell
- 08 ruby
- 09 forth
- 10 lua
- 11 php
- 12 erlang
- 13 crystal
- 14 scala
- 15 csharp
- 16 coffeescript
- 17 kotlin
- 18 java
- 19 deno
- 20 node
- 21 go
- 22 bun
- 23 fortran
- 24 rust
- 25 cpp-clang
- 26 cpp-gcc
- 27 c-clang
- 28 c-gcc
- 29 nim
- 30 pascal
- 31 zig
- 32 assembly
# - 00_tcl
- 01_prolog
- 02_smalltalk
- 03_python3
- 04_julia
- 05_perl
- 06_cobol
- 07_haskell
- 08_ruby
- 09_forth
- 10_lua
- 11_php
- 12_erlang
- 13_crystal
- 14_scala
- 15_csharp
- 16_coffeescript
- 17_kotlin
- 18_java
- 19_deno
- 20_node
- 21_go
- 22_bun
- 23_fortran
- 24_rust
- 25_cpp-clang
- 26_cpp-gcc
- 27_c-clang
- 28_c-gcc
- 29_nim
- 30_pascal
- 31_zig
- 32_assembly
runs-on: ubuntu-latest
container:
image: acheronfail/count
Expand All @@ -55,14 +55,18 @@ jobs:
uses: actions/checkout@v3
# really github? why do you override $HOME?
# https://github.com/actions/runner/issues/863
- run: 'echo HOME=/root >> $GITHUB_ENV'
- name: Setup environment
run: |
echo HOME=/root >> $GITHUB_ENV
WHAT=${{ matrix.build }}
echo WHAT=${WHAT##*_} >> $GITHUB_ENV
# do the thing
- run: just test ${{ matrix.build }}
- run: just measure ${{ matrix.build }}
- run: just test ${WHAT}
- run: just measure ${WHAT}
# report
- uses: actions/upload-artifact@v3
with:
path: 'results/${{ matrix.build }}.json'
path: 'results/${WHAT}.json'

report:
needs: ['run']
Expand Down
17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM ubuntu:latest
FROM ubuntu:23.04

ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"

RUN apt-get update && apt-get install -y \
bc build-essential clang coffeescript curl default-jdk default-jre erlang \
fp-compiler gdb lldb gforth gfortran git gnu-smalltalk gnucobol3 golang \
haskell-platform jq kotlin lua5.4 mono-complete moreutils nasm php ruby \
scala swi-prolog tar tcl unzip wget xz-utils \
bc build-essential clang curl default-jdk default-jre erlang fp-compiler gdb \
ghc lldb gforth gfortran git gnu-smalltalk gnucobol3 golang jq kotlin lua5.4 \
mono-complete moreutils nasm php ruby scala swi-prolog tar tcl unzip wget \
xz-utils \
&& apt-get clean
RUN curl -fSL https://deb.nodesource.com/setup_lts.x | bash - \
&& apt-get install -y nodejs
&& apt-get install -y nodejs \
&& npm install --global coffeescript

RUN curl -fSL https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
ENV PATH="/root/.cargo/bin:$PATH"
Expand All @@ -28,7 +29,7 @@ ENV PATH="/root/.bun/bin:$PATH"
RUN curl -fSL https://deno.land/x/install/install.sh | sh
ENV PATH="/root/.deno/bin:$PATH"

RUN curl -fSL https://crystal-lang.org/install.sh | bash
RUN curl -fSL https://crystal-lang.org/install.sh | bash -s -- --version=1.11

RUN curl -fSL https://nim-lang.org/choosenim/init.sh | sh -s -- -y
ENV PATH="/root/.nimble/bin:$PATH"
Expand All @@ -40,4 +41,6 @@ RUN cd && curl -fSL "$(curl -fSL https://ziglang.org/download/index.json | jq -r
&& rm zig.tar.xz
ENV PATH="/root/.zig:$PATH"

RUN cargo install --git https://github.com/acheronfail/max_rss.git --rev fae12f9

WORKDIR /var/count
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ measure what:
jq '. += {"size":"'"$(cat SIZE)"'"}' "$out" | sponge "$out"
fi

gdb --command rss.gdb --args $(cat CMD) >/dev/null
jq '. += {"rss":'$(( $(rg -oPr '$1' 'Rss:\s*(\d+)' ./rss.txt) * 1024 ))'}' "$out" | sponge "$out"
max_rss $(cat CMD)
jq '. += {"rss":'$(jq '.max_rss' ./max_rss.json)'}' "$out" | sponge "$out"

measure-all:
#!/usr/bin/env bash
Expand Down

0 comments on commit fae1242

Please sign in to comment.