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

Timing tests #44

Open
joelberkeley opened this issue Dec 26, 2023 · 7 comments
Open

Timing tests #44

joelberkeley opened this issue Dec 26, 2023 · 7 comments

Comments

@joelberkeley
Copy link

joelberkeley commented Dec 26, 2023

I'd like to time my tests, but the test function exits the program so I can't stick a System.time before and after it

@buzden
Copy link
Collaborator

buzden commented Dec 26, 2023

Do you want time being printed for a property or, say, min/max/av of each test in each property?

Or do you want to measure time just once? In this case, you can run checkGroup instead of test?

@joelberkeley
Copy link
Author

joelberkeley commented Dec 26, 2023

Detailed timing hadn't occured to me, but that would be cool. I imagine per property or group would be ideal, since I'm really interested in the timing for specific parts of my code, not the whole lot. Thanks for the tip re checkGroup

@joelberkeley
Copy link
Author

joelberkeley commented Dec 26, 2023

I guess I could contribute this function myself. Would System.time be the best? Millisecond timing would be preferrable

@joelberkeley
Copy link
Author

it would require adding IO to the runner. Is that a good idea?

@buzden
Copy link
Collaborator

buzden commented Dec 26, 2023

it would require adding IO to the runner. Is that a good idea?

No, it's not. Everything is abstracted in the runner to be able to run Hedgehog in different environment, to test Hedgehog by Hedgehog in particular. So, every functionality is moved to a separate interface, like it's done with HasTerminal and CanInitSeed and similar interfaces.

I personally think there is no need to invent your own interface for this, since there is a library with such interface already: https://github.com/buzden/idris2-time-for-sleep/blob/master/src/System/Time.idr#L151
@stefan-hoeck recently said that he does not mind adding external dependencies to well-maintained well-document libraries. If currently this library is not considered so, well, I can put some effort to document it. Also, this lacks some Interpolation instances for time types to have nicely printable time, but I'll do this, I wanted to do this anyway.

@joelberkeley
Copy link
Author

this is more complicated than I expected. I don't have the head space for something non-trivial, sorry

@joelberkeley
Copy link
Author

joelberkeley commented Dec 26, 2023

but yes I see the pattern and how your lib fits that pattern

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

No branches or pull requests

2 participants