GROOVY-11947: Add timing utility methods (timed, timedNanos) and Time…#2654
Open
paulk-asert wants to merge 1 commit into
Open
GROOVY-11947: Add timing utility methods (timed, timedNanos) and Time…#2654paulk-asert wants to merge 1 commit into
paulk-asert wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2654 +/- ##
==================================================
+ Coverage 68.5728% 68.5732% +0.0004%
- Complexity 33803 33808 +5
==================================================
Files 1524 1525 +1
Lines 128128 128139 +11
Branches 23289 23289
==================================================
+ Hits 87861 87869 +8
- Misses 32468 32469 +1
- Partials 7799 7801 +2
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new timing-related Groovy-JDK extension methods on System to measure elapsed execution time (in nanos/millis) and to return a structured result/time pair via a new Timed record.
Changes:
- Add
System.timedNanos(Closure),System.timedMillis(Closure), andSystem.timed(Closure)extension methods inDefaultGroovyStaticMethods. - Introduce
groovy.time.Timed(record) to hold the closure result and elapsed nanos, with convenientduration/millisviews. - Add JUnit tests covering the new
System.*timed*APIs and exception propagation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/test/groovy/org/codehaus/groovy/runtime/DefaultGroovyStaticMethodsTest.groovy | Adds tests for the new System.timed* extension methods. |
| src/main/java/org/codehaus/groovy/runtime/DefaultGroovyStaticMethods.java | Implements new timing extension methods using System.nanoTime(). |
| src/main/java/groovy/time/Timed.java | Adds a new Timed record to represent (result, nanos) plus derived duration/millis accessors. |
…d record to groovy-jdk
✅ All tests passed ✅🏷️ Commit: 88bb9ff Learn more about TestLens at testlens.app. |
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.
…d record to groovy-jdk