-
Notifications
You must be signed in to change notification settings - Fork 43
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
Improve performance with large program #1285
Conversation
Signed-off-by: Seonghyun Kim <[email protected]>
Signed-off-by: Seonghyun Kim <[email protected]>
fd2917d
to
6e7fef0
Compare
@@ -120,7 +120,7 @@ static Value callExportedFunction(ExecutionState& state, Value thisValue, size_t | |||
// Otherwise, | |||
// Let values be << >>. | |||
ValueVector values; | |||
values.resizeWithUninitializedValues(ret.size); | |||
values.resizeFitWithUninitializedValues(ret.size); |
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.
What about replacing all the use cases of resizeWithUninitializedValues
by resizeFitWithUninitializedValues
?
IMO its better to replace them all because the most case of resizeWithUninitializedValues
just use the initial size with no extension. Correct this if wrong.
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.
Some cases use TightVector. so there is no resizeFitWithUninitializedValues needs :(
Signed-off-by: Seonghyun Kim <[email protected]>
*p = m_transitionTableVectorBufferSize; | ||
p++; | ||
*p = m_transitionTableVectorBufferCapacity; |
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.
IMHO this part of variable segments is a bit confusing,
What about using an union member variables instead?
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.
I wanted to use union but there is no function to limit union size below 1 byte :(
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.
Oh, I see..
ASSERT(propertyCount < 65535); | ||
if (LIKELY(propertyCount)) { | ||
m_lastFoundPropertyName = m_properties->back().m_propertyName; | ||
setLastFoundPropertyIndex(propertyCount - 1); |
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.
When initialized, the last property info is cached.
Is the last property likely to be accessed after initialization?
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.
Yes. many programs use last property just after adding it
m_values.resizeWithUninitializedValues(0, propertyCount); | ||
bool hasIndexPropertyName = false; | ||
bool hasSymbolPropertyName = false; | ||
bool hasNonAtomicPropertyName = false; | ||
bool hasEnumerableProperty = false; | ||
ObjectStructureItemVector* keyVector = new ObjectStructureItemVector(); | ||
keyVector->resizeFitWithUninitializedValues(propertyCount); |
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.
Here, m_values
are initialized with resizeWithUninitializedValues
, but keyVector
with resizeFitWithUninitializedValues
.
Is this intended? what about using the same intializing method for both?
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.
values vector also uses TightVector(w/ realloc)
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.
LGTM 👍
No description provided.