Skip to content

Fix issues with __proto__ fields in json domain#12692

Merged
CraigMacomber merged 1 commit into
microsoft:mainfrom
CraigMacomber:defineProperty
Oct 26, 2022
Merged

Fix issues with __proto__ fields in json domain#12692
CraigMacomber merged 1 commit into
microsoft:mainfrom
CraigMacomber:defineProperty

Conversation

@CraigMacomber
Copy link
Copy Markdown
Contributor

Description

Fix same bug as in #12687 except in cursorToJsonObject and generic JS object clone code for perf comparison.

The old code would change the prototype of the object (via the proto field defined on the prototype), while the new code adds an enumerable own property that shadows proto.

benchmarks show a slight slowdown with this change, around 2-3% for cursorToJsonObject, and around 6% for the raw JS object clone reference.

@CraigMacomber CraigMacomber requested a review from a team as a code owner October 26, 2022 22:59
@github-actions github-actions Bot added area: dds Issues related to distributed data structures base: main PRs targeted against main branch labels Oct 26, 2022
@CraigMacomber CraigMacomber merged commit 2321f9b into microsoft:main Oct 26, 2022
@CraigMacomber CraigMacomber deleted the defineProperty branch October 26, 2022 23:36
CraigMacomber added a commit that referenced this pull request Oct 27, 2022
## Description

Fix bug in #12692 . Old version of the assignment was accidently left in
one spot after restoring it to do performance comparison.
@@ -119,6 +119,13 @@ export function cursorToJsonObject(reader: ITreeCursor): JsonCompatible {
const key = cursor.getFieldKey() as LocalFieldKey;
assert(cursor.firstNode(), 0x420 /* expected non-empty field */);
result[key] = cursorToJsonObject(reader);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you forget to delete this line?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, see #12695

sharptrip pushed a commit to sharptrip/FluidFramework that referenced this pull request Oct 28, 2022
## Description

Fix same bug as in microsoft#12687 except in cursorToJsonObject and generic JS
object clone code for perf comparison.

The old code would change the prototype of the object (via the __proto__
field defined on the prototype), while the new code adds an enumerable
own property that shadows __proto__.

benchmarks show a slight slowdown with this change, around 2-3% for
cursorToJsonObject, and around 6% for the raw JS object clone reference.
sharptrip pushed a commit to sharptrip/FluidFramework that referenced this pull request Oct 28, 2022
## Description

Fix bug in microsoft#12692 . Old version of the assignment was accidently left in
one spot after restoring it to do performance comparison.
alexvy86 pushed a commit to alexvy86/FluidFramework that referenced this pull request Nov 1, 2022
## Description

Fix bug in microsoft#12692 . Old version of the assignment was accidently left in
one spot after restoring it to do performance comparison.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: dds Issues related to distributed data structures base: main PRs targeted against main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants