Skip to content

improve perf of junit bindings#1045

Merged
trunk-io[bot] merged 1 commit intomainfrom
dylan/improve-perf
Mar 3, 2026
Merged

improve perf of junit bindings#1045
trunk-io[bot] merged 1 commit intomainfrom
dylan/improve-perf

Conversation

@dfrankland
Copy link
Member

@dfrankland dfrankland commented Mar 2, 2026

saves a lot of allocation and deallocation

@trunk-io
Copy link

trunk-io bot commented Mar 2, 2026

😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details.

@dfrankland dfrankland marked this pull request as ready for review March 2, 2026 22:53
Comment on lines -94 to +97
let test_cases: Vec<BindingsTestCase> = test_case_runs
let parent_name_map: HashMap<String, Vec<BindingsTestCase>> = test_case_runs
.into_iter()
.map(BindingsTestCase::from)
.collect();
let parent_name_map: HashMap<String, Vec<BindingsTestCase>> =
test_cases.iter().fold(HashMap::new(), |mut acc, testcase| {
.fold(HashMap::new(), |mut acc, testcase| {
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 combined these operations to skip allocating a Vec when we iterate over the results of the Vec anyways

Comment on lines -101 to +103
acc.entry(parent_name.clone())
.or_default()
.push(testcase.to_owned());
if let Some(parent_name_vec) = acc.get_mut(parent_name) {
parent_name_vec.push(testcase);
} else {
acc.insert(parent_name.to_string(), vec![testcase]);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Only clone the parent_name when needed

Comment on lines -265 to +266
pub fn extra(&self) -> HashMap<String, String> {
self.extra.clone()
pub fn extra(&self) -> &HashMap<String, String> {
&self.extra
Copy link
Member Author

Choose a reason for hiding this comment

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

The caller can clone if needed

level,
test_suites,
valid_test_suites: valid_test_suites.into_iter().collect(),
valid_test_suites,
Copy link
Member Author

Choose a reason for hiding this comment

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

not needed

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.81%. Comparing base (12ed854) to head (7554c0a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1045      +/-   ##
==========================================
+ Coverage   81.55%   81.81%   +0.25%     
==========================================
  Files          69       69              
  Lines       14691    14691              
==========================================
+ Hits        11981    12019      +38     
+ Misses       2710     2672      -38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trunk-io
Copy link

trunk-io bot commented Mar 3, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@trunk-io trunk-io bot merged commit bddc7a9 into main Mar 3, 2026
25 checks passed
Copy link
Collaborator

@TylerJang27 TylerJang27 left a comment

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants