Skip to content

Conversation

@ChrisDenton
Copy link
Member

@ChrisDenton ChrisDenton commented Dec 21, 2024

If the bytes written to LineWriter contains at least one new line but doesn't end in a new line (e.g. "abc\ndef") then we:

  • write up to the last new line direct to the underlying Writer.
  • copy as many of the remaining bytes as will fit into our internal buffer.

That last step is inefficient if the remaining bytes are larger than our buffer. It will needlessly split the bytes in two, requiring at least two writes to the underlying Writer (one to flush the buffer, one more to write the rest). This PR skips the extra buffering if the remaining bytes are larger than the buffer.

Also update the tests to avoid testing implementation details.
@rustbot
Copy link
Collaborator

rustbot commented Dec 21, 2024

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 21, 2024
@tgross35
Copy link
Contributor

Sorry this took so long but looks reasonable!

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 31, 2024

📌 Commit fdb43ef has been approved by tgross35

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 31, 2024
@bors
Copy link
Collaborator

bors commented Dec 31, 2024

⌛ Testing commit fdb43ef with merge b5f4319...

@rust-log-analyzer
Copy link
Collaborator

The job i686-msvc failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [run-make] tests\run-make\extern-flag-pathless stdout ----

error: rmake recipe failed to complete
status: exit code: 1
command: "C:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\test\\run-make\\extern-flag-pathless\\rmake.exe"
--- stderr -------------------------------
command failed at line 14
command failed at line 14
Command { cmd: "C:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\bin\\rustc.exe" "-L" "C:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\test\\run-make\\extern-flag-pathless\\rmake_out" "bar.rs" "--crate-type" "rlib" "--crate-type" "dylib" "-Cprefer-dynamic", stdin_buf: None, stdin: None, stdout: None, stderr: None, drop_bomb: DropBomb { command: "C:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\bin\\rustc.exe", defused: true, armed_location: Location { file: "C:\\a\\rust\\rust\\tests\\run-make\\extern-flag-pathless\\rmake.rs", line: 14, col: 5 } }, already_executed: true }
output status: `exit code: 1`
=== STDOUT ===


=== STDERR ===
=== STDERR ===
error: couldn't create a temp dir: Access is denied. (os error 5) at path "C:\\a\\_temp\\msys64\\tmp\\rustck4OIAb"
error: aborting due to 1 previous error
------------------------------------------


---
test result: FAILED. 283 passed; 1 failed; 98 ignored; 0 measured; 0 filtered out; finished in 110.57s

Some tests failed in compiletest suite=run-make mode=run-make host=i686-pc-windows-msvc target=i686-pc-windows-msvc
Build completed unsuccessfully in 1:42:36
make: *** [Makefile:106: ci-msvc-ps1] Error 1
  network time: Tue, 31 Dec 2024 10:34:07 GMT
##[error]Process completed with exit code 2.
Post job cleanup.
[command]"C:\Program Files\Git\bin\git.exe" version

@bors
Copy link
Collaborator

bors commented Dec 31, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 31, 2024
@ChrisDenton
Copy link
Member Author

ChrisDenton commented Dec 31, 2024

@bors retry spurious i686-msvc couldn't create a temp dir: Access is denied.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 31, 2024
@jieyouxu jieyouxu added CI-spurious-fail-mingw CI spurious failure: target env mingw CI-spurious-fail-msvc CI spurious failure: target env msvc and removed CI-spurious-fail-mingw CI spurious failure: target env mingw labels Dec 31, 2024
@jieyouxu
Copy link
Member

(Actually this one is i686-msvc)

@ChrisDenton
Copy link
Member Author

Edited for future reference. Too many platforms.

@bors
Copy link
Collaborator

bors commented Dec 31, 2024

⌛ Testing commit fdb43ef with merge 7a0cde9...

@bors
Copy link
Collaborator

bors commented Dec 31, 2024

☀️ Test successful - checks-actions
Approved by: tgross35
Pushing 7a0cde9 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 31, 2024
@bors bors merged commit 7a0cde9 into rust-lang:master Dec 31, 2024
7 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 31, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7a0cde9): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.2%, secondary 3.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.5% [2.5%, 2.5%] 1
Regressions ❌
(secondary)
3.5% [3.5%, 3.5%] 1
Improvements ✅
(primary)
-2.8% [-2.8%, -2.8%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.2% [-2.8%, 2.5%] 2

Cycles

Results (secondary 4.8%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.8% [4.0%, 6.0%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 760.593s -> 759.631s (-0.13%)
Artifact size: 325.49 MiB -> 325.60 MiB (0.03%)

@ChrisDenton ChrisDenton deleted the line-writer branch January 3, 2025 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-spurious-fail-msvc CI spurious failure: target env msvc merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants