From 0a4e97f5d13e278bcab7b1d43b83b8b6479591af Mon Sep 17 00:00:00 2001 From: Im-Beast Date: Fri, 28 Jun 2024 17:50:50 +0200 Subject: [PATCH] fix(ci): fix running benchmark --- .github/workflows/deno.yml | 1 + deno.jsonc | 6 ++++-- deno.lock | 8 ++++++++ tests/bench.ts | 14 +++++++------- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deno.yml b/.github/workflows/deno.yml index 096357d..4b179e7 100644 --- a/.github/workflows/deno.yml +++ b/.github/workflows/deno.yml @@ -40,6 +40,7 @@ jobs: run: deno publish --dry-run - name: Run benchmarks + # TODO: Cross-runtime benchmarks run: deno task bench - name: Check license headers diff --git a/deno.jsonc b/deno.jsonc index a0dd28b..47d23aa 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -5,7 +5,9 @@ "imports": { // tests "@std/assert": "jsr:@std/assert@0.221.0", - "@beast/compat": "jsr:@beast/compat@^0.2.5" + "@beast/compat": "jsr:@beast/compat@^0.2.5", + // bench + "@crayon/literal": "jsr:@crayon/literal@1.0.0-alpha.1" }, "exports": { @@ -24,7 +26,7 @@ "tasks": { "test": "deno test --coverage --fail-fast=1 --allow-env", - "bench": "deno bench --allow-read --ignore=node --allow-env", + "bench": "deno bench --no-check --allow-read --ignore=node --allow-env", "bench-nocolor": "NO_COLOR=1 deno task bench", "bench-colorless": "COLORTERM='' TERM='' deno task bench", diff --git a/deno.lock b/deno.lock index 0265a02..a334a40 100644 --- a/deno.lock +++ b/deno.lock @@ -3,6 +3,7 @@ "packages": { "specifiers": { "jsr:@beast/compat@^0.2.5": "jsr:@beast/compat@0.2.5", + "jsr:@crayon/literal@1.0.0-alpha.1": "jsr:@crayon/literal@1.0.0-alpha.1", "jsr:@std/assert@0.221.0": "jsr:@std/assert@0.221.0", "jsr:@std/fmt@^0.221.0": "jsr:@std/fmt@0.221.0", "npm:@types/node": "npm:@types/node@18.16.19", @@ -16,6 +17,12 @@ "@beast/compat@0.2.5": { "integrity": "f65f509c741584e3282d975d81c91a152441f77ea8c17ec51a4b757e6632d412" }, + "@crayon/literal@1.0.0-alpha.1": { + "integrity": "bcdc1421d1a5db29f5bbc3bc99d646f28cb390202c7afedd4638ddbf559eba20", + "dependencies": [ + "jsr:@crayon/crayon@4.0.0-alpha.2" + ] + }, "@std/assert@0.221.0": { "integrity": "a5f1aa6e7909dbea271754fd4ab3f4e687aeff4873b4cef9a320af813adb489a", "dependencies": [ @@ -96,6 +103,7 @@ "workspace": { "dependencies": [ "jsr:@beast/compat@^0.2.5", + "jsr:@crayon/literal@1.0.0-alpha.1", "jsr:@std/assert@0.221.0" ] } diff --git a/tests/bench.ts b/tests/bench.ts index 2398cb4..56bee94 100644 --- a/tests/bench.ts +++ b/tests/bench.ts @@ -1,6 +1,6 @@ // Copyright 2024 Im-Beast. All rights reserved. MIT license. import crayon, { buildCrayon } from "../main.ts"; -// TODO: Add literal benchmarks after literal extension has been published +import "@crayon/literal"; import chalk4 from "npm:chalk@^4"; import chalk5, { Chalk } from "npm:chalk@^5"; @@ -266,7 +266,7 @@ async function chainFunctions() { // Kleur and Ansi-colors don't have color functions } -async function _shortLiteral() { +async function shortLiteral() { const group = "short-literal"; await Deno.bench({ @@ -288,7 +288,7 @@ async function _shortLiteral() { // Cliffy, Kleur and Ansi-colors don't support literal templating } -async function _longLiteral() { +async function longLiteral() { const group = "long-literal"; await Deno.bench({ @@ -310,7 +310,7 @@ async function _longLiteral() { // Cliffy, Kleur and Ansi-colors don't support literal templating } -async function _longTextLiteral() { +async function longTextLiteral() { const group = "long-text-literal"; await Deno.bench({ @@ -360,8 +360,8 @@ cachedShortChain(); cachedLongChain(); chainFunctions(); -// shortLiteral(); -// longLiteral(); -// longTextLiteral(); +shortLiteral(); +longLiteral(); +longTextLiteral(); generateInstance();