Repository navigation
perf: mark error handling functions as cold and non-inlineable - #14801
Conversation
Merging this PR will degrade performance by 10.03%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
b456ea2 to
690e5e4
Compare
|
GNU testsuite comparison: |
3b62942 to
3fbd67a
Compare
| cp-error-same-file = { $source } and { $dest } are the same file | ||
| cp-error-backing-up-destroy-source = backing up { $dest } might destroy source; { $source } not copied | ||
| cp-error-cannot-open-for-reading = cannot open { $source } for reading | ||
| cp-error-cannot-open-for-reading = cannot open { $source } for reading: permission denied |
There was a problem hiding this comment.
gnu prints "Permission denied" with a capital P here. could you please keep the message and the io error separate?
There was a problem hiding this comment.
Right, this would be fixing a regression from #5004.
| "source" => entry.source_relative.quote() | ||
| ), | ||
| )); | ||
| show!(CpError::CannotOpenForReading(entry.source_relative.clone())); |
There was a problem hiding this comment.
we drop e here, so any other permission-denied cause gets the same fixed text. please add a test in tests/by-util/test_cp.rs covering the new variant.
7d30714 to
aacd4c6
Compare
Error construction is infrequently executed compared with the normal success paths. Mark these functions with `#[cold]` so the compiler can treat them as unlikely code paths and keep cold code separate from hot code. Use `#[inline(never)]` to prevent error-handling code from being inlined into their callers, avoiding unnecessary code-size growth and keeping the normal execution paths smaller.
aacd4c6 to
1d5c49a
Compare
Error construction is infrequently executed compared with the normal success paths. Mark these functions with
#[cold]so the compiler can treat them as unlikely code paths and keep cold code separate from hot code.Use
#[inline(never)]to prevent error-handling code from being inlined into their callers, avoiding unnecessary code-size growth and keeping the normal execution paths smaller.We get a nice size reduction for
releaseprofile (33.7 KiB):But but not for
release-small:Measurements taken from 3b62942 (head) vs b198c70 (base).