-
-
Notifications
You must be signed in to change notification settings - Fork 677
feat: Map support constructor initialization with MapInitialEntries #2941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
970fdb2
6ac8e6a
d746161
71fefe7
4b5981f
bcd86f2
5d0ecdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -73,14 +73,12 @@ export class Map<K,V> { | |||||
private entriesOffset: i32 = 0; | ||||||
private entriesCount: i32 = 0; | ||||||
|
||||||
constructor(initialEntries: MapInitialEntries<K,V> = []) { | ||||||
let entriesLength = initialEntries.length; | ||||||
|
||||||
if (entriesLength > 0) { | ||||||
if (entriesLength >= this.entriesCapacity) this.bucketsMask = entriesLength; | ||||||
constructor(initialEntries: MapInitialEntries<K,V> | null = null) { | ||||||
if (initialEntries) { | ||||||
|
if (initialEntries) { | |
if (!initialEntries || !initialEntries.length) return; |
This will reduce one level of ident
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad for suggesting that
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz cache initialEntries.length
into var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz revert this cached entriesLength var and use instead
initialEntries.length