Comments (4)
cc @YoniFeng, since you are really good at this kind of low level stuff, and I'm learning a lot from you.
from oxc.
Relevant CPU profile:
from oxc.
I need to get a setup for profiling native applications(on Windows..), been lazy so far.
Most of my profiling analysis experience is from a previous job where the profiling was already instrumented on production machines, and the data was served on a silver platter (and it was mostly non-native).
From reading indextree's doc and skimming the code, I'm skeptical that hand-rolling this tree on bumpallo will see significant gains.
However, I did notice that the append
we use in create_ast_node
isn't specialized for a new node.
pub fn checked_append<T>(
self,
new_child: NodeId,
arena: &mut Arena<T>,
) -> Result<(), NodeError> {
if new_child == self {
return Err(NodeError::AppendSelf);
}
if arena[self].is_removed() || arena[new_child].is_removed() {
return Err(NodeError::Removed);
}
if self.ancestors(arena).any(|ancestor| new_child == ancestor) {
return Err(NodeError::AppendAncestor);
}
new_child.detach(arena);
insert_with_neighbors(arena, new_child, Some(self), arena[self].last_child, None)
.expect("Should never fail: `new_child` is not `self` and they are not removed");
Ok(())
}
In our case, everything above insert_with_neighbors()
is redundant work for us.
Even within insert_with_neighbors()
, there's a detach_from_siblings()
call which is redundant when we know the inserted node is new (and even beyond the "new node" use case - it's redundant because it was just performed in detach
).
In your profiling screenshot detach_from_siblings
is 50ms which would get shaved off.
Probably worth checking out some sort of an append_new_node
fast path, where it's the user's responsibility to uphold assumptions.
TL;DR I think making trying to make changes in indextree
makes more sense, at least for a first approach.
You can assign this issue to me.
from oxc.
Done in #122.
from oxc.
Related Issues (20)
- bug(parser): Parsing computed member expressions inside decorators fails
- eslint-plugin-regexp
- Re-design `ScopeFlags` HOT 4
- oxc_traverse: cannot publish the build script HOT 1
- Fast path for parsing decimal literals HOT 3
- Change type of padding in lexer `Token`? HOT 1
- Linter: Error when setting initial state in constructor of class component HOT 4
- Convert lexer to iterate over bytes instead of chars
- Convert simple byte handlers in lexer to branchless code
- CI: add oxlint-ecosystem-ci action to the main repo. HOT 2
- linter: option to disable oxc and deepscan rules HOT 2
- linter: map rules of hooks to react-hooks HOT 1
- Niche Optimization for `Option<ReferenceId>` and `IndexVec<ReferenceId, T>` HOT 7
- react/jsx-no-undef consistency HOT 4
- Parser Fuzz Errors
- linter: panic in `jest/expect-expect` HOT 3
- linter: panic in `jest/no_conditional_expect`
- Incorrect reference flags for `x++` and `x--` HOT 1
- React false positive in a pure Vue application HOT 2
- linter: configuration file json schema HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oxc.