Skip to content

Conversation

@dishmaker
Copy link
Contributor

Before:

quote$ cargo llvm-lines --release | head -n 3
  Lines               Copies             Function name
  -----               ------             -------------
  8959                447                (TOTAL)

After:

quote$ cargo llvm-lines --release | head -n 3
  Lines               Copies             Function name
  -----               ------             -------------
  8495                424                (TOTAL)

@dtolnay dtolnay merged commit 1253e29 into dtolnay:master Nov 3, 2025
11 checks passed
@dishmaker
Copy link
Contributor Author

dishmaker commented Nov 3, 2025

Weird. On latest master total lines actually increased.

quote$ git log
commit 1253e2919ee22d51c94b61494c7e2de9e9392a3c (HEAD -> master, origin/master, origin/HEAD)
Merge: 6280f98 be59ab1
Author: David Tolnay <[email protected]>
Date:   Mon Nov 3 13:05:13 2025 -0800

    Merge pull request #308 from dishmaker/dishmaker/perf_llvml_runtime_append_arr
    
    perf: reduce llvm-lines by removing `.extend([_; 2])`

quote$ cargo llvm-lines --release | head -n 3
  Lines               Copies             Function name
  -----               ------             -------------
  8658                365                (TOTAL)

quote$ cargo -V
cargo 1.93.0-nightly (636800288 2025-10-31)

@dtolnay
Copy link
Owner

dtolnay commented Nov 3, 2025

Related to <TokenStream as TokenStreamExt>::append from #305.

// 8662 lines

do_append(self, token.into());
fn do_append(stream: &mut TokenStream, tree: TokenTree) {
    stream.extend(Some(tree));
}
// 8672 lines

do_append(self, token.into());
fn do_append(stream: &mut TokenStream, tree: TokenTree) {
    stream.extend(iter::once(tree));
}
// 7768 lines

self.extend(iter::once(token.into()));
// 9376 lines

self.extend(Some(token.into()));

@dtolnay dtolnay mentioned this pull request Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants