perf(array): add dense array fast-path for Array.prototype.unshift#5329
Open
Exar04 wants to merge 1 commit intoboa-dev:mainfrom
Open
perf(array): add dense array fast-path for Array.prototype.unshift#5329Exar04 wants to merge 1 commit intoboa-dev:mainfrom
Exar04 wants to merge 1 commit intoboa-dev:mainfrom
Conversation
Signed-off-by: Exar04 <yashdhadwe@gmail.com>
c217680 to
a4a2a88
Compare
Exar04
commented
Apr 13, 2026
| let props = &mut o_borrow.properties_mut().indexed_properties; | ||
|
|
||
| let fast_path = match props { | ||
| IndexedProperties::DenseI32(dense) if dense.len() as u64 == len => { |
Author
There was a problem hiding this comment.
Here we are iterating over values that will be added to array and converting it to type i32.
But what if we encounter string or f64? according to blog shared in issue, the type of array should get converted to lower type i.e DenseI32 -> DenseF64.
But we aren't doing that here (even before I added this code), is it getting handled somewhere else?
also if I am right about above, instead of getting out of match when encountering f64 instead of i32 it would be more performant to try again match.
something like this ->
fn main() {
let mut b = 1;
let a = loop {
match b {
1 => {
b = 2;
if b == 2{
continue
}
break "one"
},
2 => break "two",
_ => break "other",
}
};
println!("{}", a);
}but idk... its just a thought
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ref: #3407