Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timings to verbose output #1105

Merged
merged 2 commits into from
Oct 24, 2023
Merged

Add timings to verbose output #1105

merged 2 commits into from
Oct 24, 2023

Conversation

f-f
Copy link
Member

@f-f f-f commented Oct 23, 2023

This PR adds to the verbose output the amount of milliseconds elapsed from the beginning of the execution, so that it's easier to find slow bits that can be sped up.

cc @JordanMartinez @finnhodgkin

It looks something like this (bikeshedding on how they should look like is welcome):

image

now <- Effect.liftEffect $ Now.now
let
(timeDiff :: Milliseconds) = Instant.diff now logOptions.startingTime
millisDoc = Ansi.foreground Ansi.White $ Ansi.bold $ Log.text $ Strings.padStart 8 $ show $ Int.round $ unwrap timeDiff
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so much nicer than the million time/timeEnds I was dropping in before!

Given that the times just ascend is the padding necessary? I'd find this hard to parse:

[80ms] ...
[802323ms] ...
[802ms] ...

But not so much this:

[4ms] ...
[10ms] ...
[75ms] ...
[80ms] ...
[2000ms] ...
[32322ms] ...

Maybe it's more noticeably jumpy at the start. Could drop it down to 4 so the nudge only happens after longer intervals?

Suggested change
millisDoc = Ansi.foreground Ansi.White $ Ansi.bold $ Log.text $ Strings.padStart 8 $ show $ Int.round $ unwrap timeDiff
millisDoc = Ansi.foreground Ansi.White $ Ansi.bold $ Log.text $ Strings.padStart 4 $ show $ Int.round $ unwrap timeDiff

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But not so much this

My eye finds that equally hard to parse, and I figured out because I started with what you're suggesting here, and ended up with the padding 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure about the square brackets though. I just wanted some separation with the rest of the log line, I guess a dash or something could work as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I care one way or another whether there's brackets or hyphens used.

I do like the current padded usage.

@f-f f-f merged commit 796d80e into master Oct 24, 2023
3 checks passed
@f-f f-f deleted the add-timings branch October 24, 2023 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants