Skip to content

Commit 11a3814

Browse files
committed
scripts
1 parent 49a24ee commit 11a3814

File tree

2 files changed

+33
-28
lines changed

2 files changed

+33
-28
lines changed

scripts/lint_rust.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pedantic()
99

1010
if [[ -f $manifest ]] ; then
1111

12-
if ! cargo clippy --manifest-path $manifest -- -F clippy::pedantic -F clippy::all -F clippy::nursery 2>&1 | grep -qE '^error:|^warning:' ; then
12+
if ! cargo clippy --manifest-path $manifest -- -D clippy::all -F clippy::pedantic -F clippy::nursery 2>&1 | grep -qE '^error:|^warning:' ; then
1313
echo -e "Day $day is \033[1;35mEPIC PEDANTIC AND NURSERY\033[0m. Amen 🙏"
1414

1515
elif ! cargo clippy --manifest-path $manifest -- -F clippy::pedantic 2>&1 | grep -qE '^error:|^warning:' ; then

scripts/runall.py

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,8 @@ def main():
648648
parser.add_argument("-n", "--dry-run", action="store_true", help="do not run")
649649
parser.add_argument("--no-build", action="store_true", help="do not build")
650650

651+
parser.add_argument("-C", "--comparison", action="store_true", help="Show languages commparison")
652+
651653
parser.add_argument("n", type=int, nargs="*", help="filter by year or year/day")
652654

653655
args = parser.parse_args()
@@ -851,34 +853,37 @@ def main():
851853
)
852854

853855
# compute languages comparison
854-
lines = []
855-
puzzles = set(map(itemgetter(0, 1), stats_elapsed.keys()))
856-
for lang1, lang2 in itertools.combinations(languages, 2):
857-
n, t1, t2 = 0, 0, 0
858-
for y, d in puzzles:
859-
t = dict((lang, t) for (yy, dd, lang), (t, _) in stats_elapsed.items() if (yy, dd) == (y, d))
860-
if lang1 in t and lang2 in t:
861-
n += 1
862-
t1 += t[lang1]
863-
t2 += t[lang2]
864-
if n > 0:
865-
if t2 < t1:
866-
t1, t2 = t2, t1
867-
lang1, lang2 = lang2, lang1
868-
faster = t2 / t1
869-
lines.append(
870-
(
871-
t1 / n,
872-
t2 / n,
873-
f"{YELLOW}{lang1:<7}{RESET}"
874-
f" vs. {YELLOW}{lang2:<7}{RESET}:"
875-
f" {GREEN}{t1/n:7.3f}s{RESET} vs. {GREEN}{t2/n:7.3f}s{RESET}"
876-
f" (x {faster:4.1f} faster) on {WHITE}{n:3}{RESET} puzzle{'s' if n>1 else ''}",
856+
if args.comparison:
857+
lines = []
858+
puzzles = set(map(itemgetter(0, 1), stats_elapsed.keys()))
859+
for lang1, lang2 in itertools.combinations(languages, 2):
860+
n, t1, t2 = 0, 0, 0
861+
for y, d in puzzles:
862+
t = dict((lang, t) for (yy, dd, lang), (t, _) in stats_elapsed.items() if (yy, dd) == (y, d))
863+
if lang1 in t and lang2 in t:
864+
n += 1
865+
t1 += t[lang1]
866+
t2 += t[lang2]
867+
if n > 0:
868+
if t2 < t1:
869+
t1, t2 = t2, t1
870+
lang1, lang2 = lang2, lang1
871+
faster = t2 / t1
872+
lines.append(
873+
(
874+
t1 / n,
875+
t2 / n,
876+
f"{YELLOW}{lang1:<7}{RESET}"
877+
f" vs. {YELLOW}{lang2:<7}{RESET}:"
878+
f" {GREEN}{t1/n:7.3f}s{RESET} vs. {GREEN}{t2/n:7.3f}s{RESET}"
879+
f" (x {faster:4.1f} faster) on {WHITE}{n:3}{RESET} puzzle{'s' if n>1 else ''}",
880+
)
877881
)
878-
)
879-
print()
880-
print("LANGUAGES COMPARISON:")
881-
print("\n".join(map(itemgetter(2), sorted(lines))))
882+
print()
883+
print("LANGUAGES COMPARISON:")
884+
print("\n".join(map(itemgetter(2), sorted(lines))))
885+
else:
886+
print("Use option -C/--comparison to display timings comparison.")
882887

883888
if problems:
884889
print()

0 commit comments

Comments
 (0)