You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "paulk-asert (via GitHub)" <gi...@apache.org> on 2026/09/02 06:20:50 UTC
[PR] GROOVY-12327: JsonSlurper: bound the cost of parsing a wide JSON object [groovy]
paulk-asert opened a new pull request, #2854:
URL: https://github.com/apache/groovy/pull/2854
LazyMap holds entries in parallel key/value arrays until something asks for a key, so the small objects that dominate JSON documents never build a backing map. Duplicate-key detection scanned those arrays linearly on every put, which costs O(n^2) comparisons for an object of n keys — on the default JsonSlurper path, and with the per-comparison cost tunable from the document by giving the keys a long common prefix. Past 32 entries put now builds the backing map and delegates, keeping insertion amortized constant-time while leaving narrow objects on the compact representation. Parsing 64k keys drops from 3048ms to 18ms, and scales linearly rather than quadratically.
Hydration sized its LinkedHashMap with a 0.01 load factor to blunt hash collisions, forcing a bucket table ~100x the entry count. Every runtime this builds for treeifies a heavily-collided String-keyed bucket by itself, so the table now uses the default load factor with capacity to match. This matters more once put hydrates during the parse rather than on first access: without it, a 0.7MB document of 3000 40-key objects retains 104MB read or not, against 10MB now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GROOVY-12327: JsonSlurper: bound the cost of parsing a wide JSON object [groovy]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #2854:
URL: https://github.com/apache/groovy/pull/2854#issuecomment-5505742389
## [Codecov](https://app.codecov.io/gh/apache/groovy/pull/2854?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 70.7994%. Comparing base ([`c251a83`](https://app.codecov.io/gh/apache/groovy/commit/c251a839e3e6182d068b1981aed2a4c4d635371d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`fbd2c37`](https://app.codecov.io/gh/apache/groovy/commit/fbd2c37934578f9dd5de3b8ae878c35956e7b059?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/2854?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #2854 +/- ##
==================================================
- Coverage 70.8002% 70.7994% -0.0008%
+ Complexity 36979 36978 -1
==================================================
Files 1576 1576
Lines 134792 134795 +3
Branches 24954 24955 +1
==================================================
+ Hits 95433 95434 +1
- Misses 30756 30757 +1
- Partials 8603 8604 +1
```
| [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2854?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [.../java/org/apache/groovy/json/internal/LazyMap.java](https://app.codecov.io/gh/apache/groovy/pull/2854?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fjson%2Finternal%2FLazyMap.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9qc29uL2ludGVybmFsL0xhenlNYXAuamF2YQ==) | `91.6667% <100.0000%> (+0.3087%)` | :arrow_up: |
... and [9 files with indirect coverage changes](https://app.codecov.io/gh/apache/groovy/pull/2854/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GROOVY-12327: JsonSlurper: bound the cost of parsing a wide JSON object [groovy]
Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert merged PR #2854:
URL: https://github.com/apache/groovy/pull/2854
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GROOVY-12327: JsonSlurper: bound the cost of parsing a wide JSON object [groovy]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #2854:
URL: https://github.com/apache/groovy/pull/2854#issuecomment-5505677716
## 🚨 TestLens detected 1 failed test 🚨
Here is what you can do:
1) Inspect the test failures carefully.
2) If you are convinced that some of the tests are flaky, you can mute them below.
3) Finally, trigger a rerun by checking the rerun checkbox.
### Test Summary
#### [Build and test / lts \(25, ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/33598439334/job/100146627522?pr=2854) > :test
| Test | Runs | Flakiness |
|---|---|--:|
| ClassInfoSoftModeStressTest > softModeSurvivesRealGcClearingUnderConcurrency\(\) | ❌ | 2% 🟡 |
🏷️ Commit: fbd2c37934578f9dd5de3b8ae878c35956e7b059
▶️ Tests: 94304 executed
🟡 Checks: 19/29 completed
### Test Failures
<details><summary><strong>ClassInfoSoftModeStressTest > softModeSurvivesRealGcClearingUnderConcurrency()</strong> (:test in <a href="https://github.com/apache/groovy/actions/runs/33598439334/job/100146627522?pr=2854">Build and test / lts (25, ubuntu-latest)</a>)</summary>
```
org.opentest4j.AssertionFailedError: stress probe failed: dispatches=5192610 generations=96 javaInfosCollected=0/36
ERROR: no Java-receiver ClassInfo was ever collected — the stress did not exercise real GC clearing
==> expected: <0> but was: <1>
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:628)
at org.codehaus.groovy.reflection.ClassInfoSoftModeStressTest.softModeSurvivesRealGcClearingUnderConcurrency(ClassInfoSoftModeStressTest.groovy:53)
```
|expected|actual|
|---|---|
|<s>0</s>|<b>1</b>|
</details>
### Rerun Controls
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
🔲 ClassInfoSoftModeStressTest > softModeSurvivesRealGcClearingUnderConcurrency\(\) <!-- uniqueId=[engine:junit-jupiter]/[class:org.codehaus.groovy.reflection.ClassInfoSoftModeStressTest]/[method:softModeSurvivesRealGcClearingUnderConcurrency()] -->
Reuse successful test results:
🔲 ♻️ Only rerun the tests that failed or were muted before
Click the checkbox to trigger a rerun:
🔲 **Rerun jobs**
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org