From 4e977168da2b496461b3bb056212d104f934a5a6 Mon Sep 17 00:00:00 2001 From: John Gerwin De las Alas Date: Sun, 25 Jan 2026 13:04:42 +0800 Subject: [PATCH] fix: use compact in compare method to showcase token savings benefits - Changed compare method to use compact() instead of encode() - Removed off on off off off off off off off off on off on off off off off off on off off off on on off off off off on off off off off off off off off off off off off on off off off off off off off on off on on off off off on off off on off off on off off on off on off off on off on off off off off on off off off on off off on off off off off off off off off on off on off off on off off off off off off off off off off off off on off off off on off on off on on off off off off on on on off on on off on off on on off off off off on on off off on off off off off off on off off on off off on off off off off off off on off off off off on on off on off off off off off on off on off off off off off off off off off off on on off on off off off parameter since compare should always showcase best-case savings - Ensures TOON's token efficiency is properly demonstrated --- src/Toon.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Toon.php b/src/Toon.php index 8cba62f..bc8e09a 100644 --- a/src/Toon.php +++ b/src/Toon.php @@ -85,11 +85,13 @@ public static function estimateTokens(string $toon): int /** * Compare TOON vs JSON token usage. * + * Uses compact format to showcase TOON's token savings benefits. + * * @return array{toon: string, json: string, toon_tokens: int, json_tokens: int, savings_percent: float} */ - public static function compare(mixed $value, ?EncodeOptions $options = null): array + public static function compare(mixed $value): array { - $toon = self::encode($value, $options); + $toon = self::compact($value); $json = json_encode($value, JSON_THROW_ON_ERROR); $toonTokens = self::estimateTokens($toon);