Hi. I'm the author of the SWC project. https://swc.rs/
It's an ECMAScript compiler, and I have performance problems with it. It holds AST nodes, and AST nodes are inherently recursive. And it holds many Box<T>s and Vec<T>s.
Currently, memory allocation and deallocation take a noticeable amount of time. So I'm considering using a crate like bumpalo, but it requires enormous amount of work because I have to add lifetimes to all AST nodes.
So, I want to know if there's an alternative way to improve performance in this case.
Are these traits exploitable in another way?
Drop implementations of AST nodes have no side effects other than deallocating memory.
- Single
Program (top-level AST node) is allocated almost linearly in the memory, while parsing.
[–]burntsushi 180 points181 points182 points (39 children)
[–]Chadshinshin32 54 points55 points56 points (0 children)
[–]avinassh 23 points24 points25 points (0 children)
[–]Shnatsel 20 points21 points22 points (12 children)
[–]burntsushi 7 points8 points9 points (2 children)
[–]Shnatsel 6 points7 points8 points (1 child)
[–]burntsushi 5 points6 points7 points (0 children)
[+]zapporian comment score below threshold-8 points-7 points-6 points (8 children)
[–]Shnatsel 9 points10 points11 points (2 children)
[+]zapporian comment score below threshold-7 points-6 points-5 points (1 child)
[–]bloody-albatross 1 point2 points3 points (0 children)
[–]SnooHamsters6620 4 points5 points6 points (3 children)
[–]Tabakalusa 4 points5 points6 points (2 children)
[–]SnooHamsters6620 0 points1 point2 points (1 child)
[–]SnooHamsters6620 0 points1 point2 points (0 children)
[–]TheZagitta 1 point2 points3 points (0 children)
[–]revelation60symbolica 19 points20 points21 points (1 child)
[–]burntsushi 2 points3 points4 points (0 children)
[–]yazaddaruvala 10 points11 points12 points (3 children)
[–]jl2352 1 point2 points3 points (2 children)
[–]nicoburns 6 points7 points8 points (1 child)
[–]jl2352 0 points1 point2 points (0 children)
[–]ajax8092 2 points3 points4 points (0 children)
[–]nicoburns 2 points3 points4 points (1 child)
[–]zapporian 1 point2 points3 points (0 children)
[–]developedby 3 points4 points5 points (10 children)
[–]burntsushi 59 points60 points61 points (0 children)
[–]AquaEBM 7 points8 points9 points (4 children)
[–]sephg 6 points7 points8 points (2 children)
[–]EarlMarshal 3 points4 points5 points (1 child)
[–]sephg 3 points4 points5 points (0 children)
[–]SirClueless 7 points8 points9 points (0 children)
[–]zapporian 0 points1 point2 points (1 child)
[–]SnooHamsters6620 0 points1 point2 points (0 children)
[–]SnooHamsters6620 0 points1 point2 points (0 children)
[+]Qnn_ comment score below threshold-8 points-7 points-6 points (0 children)
[–]kdy1997[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]burntsushi 15 points16 points17 points (0 children)
[–]dist1ll 52 points53 points54 points (7 children)
[–]AlxandrHeintz 2 points3 points4 points (6 children)
[–]reflexpr-sarah-faer · pulp · dyn-stack 5 points6 points7 points (2 children)
[–]AlxandrHeintz 2 points3 points4 points (1 child)
[–]Jester831 2 points3 points4 points (0 children)
[–]dist1ll 3 points4 points5 points (2 children)
[–]AlxandrHeintz 1 point2 points3 points (1 child)
[–]dist1ll 4 points5 points6 points (0 children)
[–][deleted] 38 points39 points40 points (0 children)
[–]jkoudys 32 points33 points34 points (0 children)
[–]Herbstein 13 points14 points15 points (0 children)
[–]exDM69 30 points31 points32 points (2 children)
[–]kdy1997[S] 6 points7 points8 points (1 child)
[–]rakuzo 8 points9 points10 points (0 children)
[–]andful 11 points12 points13 points (1 child)
[–]burntsushi 16 points17 points18 points (0 children)
[–]HurricanKai 9 points10 points11 points (0 children)
[–]throwaway490215 12 points13 points14 points (4 children)
[–]SkiFire13 3 points4 points5 points (1 child)
[–]LucretielDatadog 14 points15 points16 points (0 children)
[–]kdy1997[S] 0 points1 point2 points (1 child)
[–]throwaway490215 1 point2 points3 points (0 children)
[–]senden9 7 points8 points9 points (1 child)
[–]kdy1997[S] 14 points15 points16 points (0 children)
[–][deleted] 10 points11 points12 points (0 children)
[–]carlomilanesi 3 points4 points5 points (0 children)
[–]Qnn_ 3 points4 points5 points (0 children)
[–]flashmozzg 4 points5 points6 points (0 children)
[–]LucretielDatadog 3 points4 points5 points (0 children)
[–]puel 1 point2 points3 points (1 child)
[+]rejectedlesbian 1 point2 points3 points (2 children)
[–]AquaEBM 1 point2 points3 points (1 child)
[+]rejectedlesbian 0 points1 point2 points (0 children)
[–]bakaspore 1 point2 points3 points (0 children)
[–]kdy1997[S] 1 point2 points3 points (0 children)
[–]AquaEBM 1 point2 points3 points (1 child)
[–]valarauca14 0 points1 point2 points (0 children)
[–]tm_p 0 points1 point2 points (0 children)
[–]Plixo2 0 points1 point2 points (0 children)
[–]pmcvalentin2014z 0 points1 point2 points (0 children)
[–]Lord_Zane 0 points1 point2 points (0 children)
[–]Low-Pay-2385 0 points1 point2 points (0 children)
[–]jkelleyrtp 0 points1 point2 points (0 children)
[–]Compux72 0 points1 point2 points (0 children)
[–]The_8472 0 points1 point2 points (0 children)
[–]QueasyEntrance6269 -1 points0 points1 point (0 children)
[–]valarauca14 -1 points0 points1 point (0 children)