Skip to content
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

Merged
merged 3 commits into from
Dec 7, 2023
Merged

Conversation

ksh8281
Copy link
Contributor

@ksh8281 ksh8281 commented Dec 6, 2023

No description provided.

@ksh8281 ksh8281 force-pushed the work65 branch 3 times, most recently from fd2917d to 6e7fef0 Compare December 7, 2023 05:37
@@ -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);
Copy link
Contributor

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.

Copy link
Contributor Author

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 :(

Comment on lines +262 to +264
*p = m_transitionTableVectorBufferSize;
p++;
*p = m_transitionTableVectorBufferCapacity;
Copy link
Contributor

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?

Copy link
Contributor Author

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 :(

Copy link
Contributor

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);
Copy link
Contributor

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?

Copy link
Contributor Author

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

Comment on lines +520 to +526
m_values.resizeWithUninitializedValues(0, propertyCount);
bool hasIndexPropertyName = false;
bool hasSymbolPropertyName = false;
bool hasNonAtomicPropertyName = false;
bool hasEnumerableProperty = false;
ObjectStructureItemVector* keyVector = new ObjectStructureItemVector();
keyVector->resizeFitWithUninitializedValues(propertyCount);
Copy link
Contributor

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?

Copy link
Contributor Author

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)

Copy link
Contributor

@clover2123 clover2123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@clover2123 clover2123 merged commit 59a626b into Samsung:master Dec 7, 2023
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants