Reduce size of Stmt from 144 to 120 bytes (#11051)

## Summary

I happened to notice that we box `TypeParams` on `StmtClassDef` but not
on `StmtFunctionDef` and wondered why, since `StmtFunctionDef` is bigger
and sets the size of `Stmt`.

@charliermarsh found that at the time we started boxing type params on
classes, classes were the largest statement type (see #6275), but that's
no longer true.

So boxing type-params also on functions reduces the overall size of
`Stmt`.

## Test Plan

The `<=` size tests are a bit irritating (since their failure doesn't
tell you the actual size), but I manually confirmed that the size is
actually 120 now.
This commit is contained in:
Carl Meyer 2024-04-19 17:02:17 -06:00 committed by GitHub
parent 99f7f94538
commit c80b9a4a90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 6 deletions

View file

@ -1738,7 +1738,7 @@ impl<'src> Parser<'src> {
ast::StmtFunctionDef {
name,
type_params,
type_params: type_params.map(Box::new),
parameters: Box::new(parameters),
body,
decorator_list,