oxc/crates
camchenry 8387bac51f perf(linter): apply small file optimization, up to 30% faster (#6600)
Theory: iterating over the rules three times has slightly worse cache locality, because the prior iterations have pushed `rule` out of the cache by the time we iterate over it again. By iterating over each rule only once, we improve cache performance (hopefully). We also don't need to collect rules to a Vec, so it saves some CPU/memory there too.

In practice: the behavior here actually depends on the number of AST nodes that are in the program. If the number of nodes is large, then it's better to iterate over the nodes only once and iterate the rules multiple times. But if the number of nodes is small, then it's better to iterate over nodes multiple times and only iterate over the rules once. See this comment for more context: https://github.com/oxc-project/oxc/pull/6600#issuecomment-2427837715, as well as the comment inside the PR: https://github.com/oxc-project/oxc/pull/6600/files#diff-207225884c5e031ffd802bb99e4fbacbd8364b1343a1cec5485bf50f29186300R131-R143.

In practice, this can make linting a file 1-45% faster, depending on the size of the file, number of AST nodes, number of files, CPU cache size, etc. To accommodate large and small files better, we have an explicit threshold of 200,000 AST nodes, which is an arbitrary number picked based on some benchmarks on my laptop. For large files, the linter behavior doesn't change. For small files, we switch to iterating over nodes in the inner loop and iterating over rules once in the outer loop.
2024-10-22 02:24:41 +00:00
..
oxc release(crates): v0.32.0 (#6691) 2024-10-19 23:09:35 +08:00
oxc_allocator refactor(allocator): move GetAddress trait into oxc_allocator (#6738) 2024-10-21 11:46:29 +00:00
oxc_ast docs(ast): improve formatting of AstBuilder doc comments (#6756) 2024-10-22 00:12:01 +00:00
oxc_ast_macros release(crates): v0.32.0 (#6691) 2024-10-19 23:09:35 +08:00
oxc_cfg release(crates): v0.32.0 (#6691) 2024-10-19 23:09:35 +08:00
oxc_codegen docs(codegen): add #![warn(missing_docs)] to oxc_codegen (#6711) 2024-10-21 00:13:57 +00:00
oxc_data_structures release(crates): v0.32.0 (#6691) 2024-10-19 23:09:35 +08:00
oxc_diagnostics release(crates): v0.32.0 (#6691) 2024-10-19 23:09:35 +08:00
oxc_ecmascript refactor(minifier): binary operations use ConstantEvaluation (#6700) 2024-10-20 15:13:27 +00:00
oxc_estree release(crates): v0.32.0 (#6691) 2024-10-19 23:09:35 +08:00
oxc_index release(crates): v0.32.0 (#6691) 2024-10-19 23:09:35 +08:00
oxc_isolated_declarations refactor(isolated-declarations): protect internal transform methods (#6723) 2024-10-21 02:03:33 +00:00
oxc_language_server refactor(oxc): remove useless allocator.alloc(program) calls (#6571) 2024-10-15 02:21:20 +00:00
oxc_linter perf(linter): apply small file optimization, up to 30% faster (#6600) 2024-10-22 02:24:41 +00:00
oxc_macros refactor(linter): add run_on_jest_node to run rules on only jest nodes (#6721) 2024-10-21 02:13:58 +00:00
oxc_mangler release(crates): v0.32.0 (#6691) 2024-10-19 23:09:35 +08:00
oxc_minifier refactor(minifier): binary operations use ConstantEvaluation (#6700) 2024-10-20 15:13:27 +00:00
oxc_module_lexer release(crates): v0.32.0 (#6691) 2024-10-19 23:09:35 +08:00
oxc_parser release(crates): v0.32.0 (#6691) 2024-10-19 23:09:35 +08:00
oxc_prettier fix(allocator)!: make Vec non-drop (#6623) 2024-10-19 15:43:54 +00:00
oxc_regular_expression feat(regular_expression): Intro ConstructorParser(and LiteralParser) to handle escape sequence in RegExp('pat') (#6635) 2024-10-21 07:07:27 +00:00
oxc_semantic refactor(ast)!: remove AstKind::FinallyClause (#6744) 2024-10-21 14:37:51 +00:00
oxc_sourcemap release(crates): v0.32.0 (#6691) 2024-10-19 23:09:35 +08:00
oxc_span docs(span): enhance Span documentation (#6707) 2024-10-21 14:32:55 +00:00
oxc_syntax refactor(ast_tools): add line breaks to generated code for ESTree derive (#6680) 2024-10-19 19:50:13 +00:00
oxc_transformer docs(transformer): correct typos and reformat doc comments (#6758) 2024-10-22 00:20:55 +00:00
oxc_traverse refactor(ast)!: remove AstKind::FinallyClause (#6744) 2024-10-21 14:37:51 +00:00
oxc_wasm chore(semantic, wasm): re-order dependencies in Cargo.toml files (#6657) 2024-10-18 13:40:37 +00:00