fix: benchmark timing broken on macOS#6
Open
hobostay wants to merge 1 commit into
Open
Conversation
`date +%s%3N` is a GNU coreutils extension not supported by BSD date on macOS. On macOS it silently outputs garbage like `1714841232%3N` without failing, so the python3 fallback never triggers and the elapsed time calculation produces wrong results or arithmetic errors under `set -e`. Use python3 as the primary method (available on both platforms since macOS ships python3), with a seconds-only fallback. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
date +%s%3Nwithpython3 -c 'import time;print(int(time.time()*1000))'as the primary timing method inrun_benchmark()Problem
date +%s%3Nis a GNU coreutils extension. macOS ships BSD date, which does not support%N. Crucially, BSD date does not fail — it outputs garbage like1714841232%3N(literal%3N), so the|| python3 ...fallback never triggers. The subsequent$((end_ms - start_ms))arithmetic either produces wrong results or errors underset -e.Test plan
./deepclaude.sh --benchmark→ should show reasonable ms timings./deepclaude.sh --benchmark→ should still work (python3 is widely available)🤖 Generated with Claude Code