Skip to content

perf(codegen): optimize Codegen::print_list method#10242

Merged
graphite-app[bot] merged 1 commit intomainfrom
04-05-perf_codegen_optimize_codegen_print_list_method
Apr 7, 2025
Merged

perf(codegen): optimize Codegen::print_list method#10242
graphite-app[bot] merged 1 commit intomainfrom
04-05-perf_codegen_optimize_codegen_print_list_method

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Apr 4, 2025

It looks like has fewer instructions than before. See https://godbolt.org/z/jE1o5rvGq

NOTE: This approach didn't bring notable performance improvement, so I don't have a strong opinion on which way.

@github-actions github-actions bot added A-codegen Area - Code Generation C-performance Category - Solution not expected to change functional behavior, only performance labels Apr 4, 2025
Copy link
Member Author

Dunqing commented Apr 4, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 4, 2025

CodSpeed Instrumentation Performance Report

Merging #10242 will not alter performance

Comparing 04-05-perf_codegen_optimize_codegen_print_list_method (6c9b094) with main (d143e95)

Summary

✅ 36 untouched benchmarks

@Boshen
Copy link
Member

Boshen commented Apr 5, 2025

Look at the comment above this function, seems like it's better this time?

@Dunqing Dunqing force-pushed the 04-05-perf_codegen_optimize_codegen_print_list_method branch from b97134a to 0a09d4e Compare April 5, 2025 05:57
@Dunqing
Copy link
Member Author

Dunqing commented Apr 5, 2025

Look at the comment above this function, seems like it's better this time?

It seems better than the last optimization while maintaining readability.

@Dunqing Dunqing requested a review from overlookmotel April 5, 2025 06:39
@Dunqing
Copy link
Member Author

Dunqing commented Apr 5, 2025

It seems adding #[inline] has no impact on performance.

@Dunqing Dunqing marked this pull request as ready for review April 5, 2025 15:20
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Apr 7, 2025
Copy link
Member

Boshen commented Apr 7, 2025

Merge activity

It looks like has fewer instructions than before. See https://godbolt.org/z/jE1o5rvGq

NOTE: This approach didn't bring notable performance improvement, so I don't have a strong opinion on which way.
@graphite-app graphite-app bot force-pushed the 04-05-perf_codegen_optimize_codegen_print_list_method branch from 1a18a6b to 6c9b094 Compare April 7, 2025 07:36
@graphite-app graphite-app bot merged commit 6c9b094 into main Apr 7, 2025
29 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Apr 7, 2025
@graphite-app graphite-app bot deleted the 04-05-perf_codegen_optimize_codegen_print_list_method branch April 7, 2025 07:43
@overlookmotel
Copy link
Member

overlookmotel commented Apr 7, 2025

Just to clarify, the purpose of this change is better readability? From the Godbolt link you gave, it looks like it makes no difference to assembly either way.

That's not criticism, I'm just interested.

@Dunqing
Copy link
Member Author

Dunqing commented Apr 10, 2025

Just to clarify, the purpose of this change is better readability? From the Godbolt link you gave, it looks like it makes no difference to assembly either way.

That's not criticism, I'm just interested.

Yes, the performance is unchanged. Boshen said that merging it because better readability.

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

Labels

A-codegen Area - Code Generation C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants