mirror of
https://github.com/swc-project/swc.git
synced 2024-11-25 22:34:04 +03:00
f2300dadbf
**Description:** `dbg!()` output on ASTs is kinda verbose, ```rs ExprStmt { span: Span { lo: BytePos( 37, ), hi: BytePos( 50, ), ctxt: #0, }, expr: Lit( Str( Str { span: Span { lo: BytePos( 37, ), hi: BytePos( 49, ), ctxt: #0, }, value: "use strict", raw: Some( "\"use strict\"", ), }, ), ), } ``` A lot of the space is wasted on spans — 9 lines per span, even though it's pretty much unimportant cruft. This PR changes that to just one line per span: ```rs ExprStmt { span: 37..50#0, expr: Lit( Str( Str { span: 37..49#0, value: "use strict", raw: Some( "\"use strict\"", ), }, ), ), } ``` While not a statistically meaningful measurement, in my tests (sample size = 1) this change reduces the `dbg!()` of a 1103-byte script from 5597 to 2885 lines, which is a 48% reduction. In `{:?}` mode it goes from 40034 to 25457 chars, or 37% reduction. |
||
---|---|---|
.. | ||
src | ||
tests | ||
Cargo.toml |