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

Move json data #1348

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Move json data #1348

wants to merge 11 commits into from

Conversation

Thomas1664
Copy link
Contributor

No description provided.

Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

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

I find this change very scary as we've had horrible bugs trying to move things around in the JSON DOM before. Do you have a benchmark showing this as meaningful?

@Thomas1664
Copy link
Contributor Author

Thomas1664 commented Feb 21, 2024

I find this change very scary as we've had horrible bugs trying to move things around in the JSON DOM before.

I don't think moving things around in the JSON DOM is scary as most of the moves are at the end of a scope so there's nothing special about them. However, I do see the argument that re-using a moved-from variable is a possible source of bugs.

Do you have a benchmark showing this as meaningful?

This PR improves the performance of create_dependency_graph_snapshot by 25% (105 us vs. 79 us).

@BillyONeal
Copy link
Member

I don't think moving things around in the JSON DOM is scary as most of the moves are at the end of a scope so there's nothing special about them.

The thing with DOMs is that their contents are shared around by different components. Moving something that was actually a component of an overall DOM has been a bug we have written a lot of.

This PR improves the performance of create_dependency_graph_snapshot by 25% (105 us vs. 79 us).

What is that in the context of an overall command using this?

@autoantwort
Copy link
Contributor

What is that in the context of an overall command using this?

This is only called after you build a package for seconds, minutes or hours.

@Thomas1664
Copy link
Contributor Author

The thing with DOMs is that their contents are shared around by different components. Moving something that was actually a component of an overall DOM has been a bug we have written a lot of.

If you read the code, you'll notice that this is not an issue here. This kind of bug can be avoided by following best practices regarding const correctness and the single responsibility principle.

@talregev
Copy link

Why we are using json? Can we switch to yaml format?

@Thomas1664

This comment was marked as off-topic.

@dg0yt
Copy link
Contributor

dg0yt commented Apr 23, 2024

YAML has its own set of problems. This is a what-about discussion and doesn't belong here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants