<commit_before>#!/bin/bash

# Generate NYTProf data, allowing us to compare the performance between two different versions

BOARD=Inverting-6

rm -rf nytprof.old*
rm -rf nytprof.new*


######## "new" configuration ########
perl -d:NYTProf ../iojoe10 $BOARD
mv nytprof.out nytprof.new.out
nytprofhtml --file nytprof.new.out --out nytprof.new

######## "old" configuration ########
            # --compare-old is a special flag, that I use specifically when doing A/B testing,
            #                   to specify the alternate configuration I want to test with
perl -d:NYTProf ../iojoe10 $BOARD --compare-old
mv nytprof.out nytprof.old.out
nytprofhtml --file nytprof.old.out --out nytprof.old

xdg-open nytprof.new/index.html
xdg-open nytprof.old/index.html<commit_msg>store nytprof.out file in ramdisk<commit_after>#!/bin/bash

# Generate NYTProf data, allowing us to compare the performance between two different versions

BOARD=Inverting-6

rm -rf nytprof.old*
rm -rf nytprof.new*



# Put the nytprof.out file in a ramdisk -- it's ~1gb, and all that activity can reduce the lifetime of my SSD.
OUTFILE_LOCATION=/tmp/nytprof.out       # Where will the nytprof.out file be located?  (it can be quite large)
# There's a ramdisk already at /run/user/$USER/, however it's awfully small.  I've got 8gb RAM, let's use it!
mount | grep /media/nytprof.ramdisk >/dev/null
if [ $? != 0 ]; then
    [ -d /media/nytprof.ramdisk/ ] || sudo mkdir -p /media/nytprof.ramdisk/
    sudo mount -t tmpfs -o size=2048M tmpfs /media/nytprof.ramdisk/
fi
mount | grep /media/nytprof.ramdisk >/dev/null
if [ $? = 0 ]; then
    OUTFILE_LOCATION=/media/nytprof.ramdisk/nytprof.out
else
    echo UNABLE TO STORE nytprof.out ON SSD
fi
export NYTPROF="file=$OUTFILE_LOCATION"



######## "new" configuration ########
perl -d:NYTProf ../iojoe10 $BOARD
nytprofhtml --file $OUTFILE_LOCATION --out nytprof.new
rm $OUTFILE_LOCATION          # this thing is ~1GB!

######## "old" configuration ########
            # --compare-old is a special flag, that I use specifically when doing A/B testing,
            #                   to specify the alternate configuration I want to test with
perl -d:NYTProf ../iojoe10 $BOARD --compare-old
nytprofhtml --file $OUTFILE_LOCATION --out nytprof.old
rm $OUTFILE_LOCATION          # this thing is ~1GB!


xdg-open nytprof.new/index.html
xdg-open nytprof.old/index.html
{'fraction_non_alphanumeric': 0.12599748005039899, 'fraction_numerical': 0.008399832003359933, 'mean_word_length': 3.193661971830986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7225080', 'n_tokens_mistral': 850, 'n_tokens_neox': 795, 'n_words': 254}