Reduce size of Expr from 80 to 64 bytes (#9900)

## Summary

This PR reduces the size of `Expr` from 80 to 64 bytes, by reducing the
sizes of...

- `ExprCall` from 72 to 56 bytes, by using boxed slices for `Arguments`.
- `ExprCompare` from 64 to 48 bytes, by using boxed slices for its
various vectors.

In testing, the parser gets a bit faster, and the linter benchmarks
improve quite a bit.
This commit is contained in:
Charlie Marsh 2024-02-08 18:53:13 -08:00 committed by GitHub
parent bd8123c0d8
commit 49fe1b85f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
78 changed files with 326 additions and 258 deletions

View file

@ -1007,7 +1007,7 @@ impl<'a> Generator<'a> {
group_if!(precedence::CMP, {
let new_lvl = precedence::CMP + 1;
self.unparse_expr(left, new_lvl);
for (op, cmp) in ops.iter().zip(comparators) {
for (op, cmp) in ops.iter().zip(&**comparators) {
let op = match op {
CmpOp::Eq => " == ",
CmpOp::NotEq => " != ",
@ -1039,7 +1039,7 @@ impl<'a> Generator<'a> {
range: _,
})],
[],
) = (arguments.args.as_slice(), arguments.keywords.as_slice())
) = (arguments.args.as_ref(), arguments.keywords.as_ref())
{
// Ensure that a single generator doesn't get double-parenthesized.
self.unparse_expr(elt, precedence::COMMA);