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

Convert internal asset, dependency, and environment fields to numbers #9663

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

devongovett
Copy link
Member

This converts some fields on our internal Asset, Dependency, and Environment types from strings/booleans to numbers/bitfields. This is mostly in preparation for the conversion to Rust, where we will want more efficient serialization, but in the interim this should also reduce the size of some objects in the JS implementation too. This was started on the Parcel DB branch but should be useful even when using something like Serde too.

Currently, for backward compatibility, some asset.meta and dependency.meta fields are proxied to internal bitflags transparently to plugins. We may eventually want to expose more official fields for these things but that can be discussed at a later time.

# Conflicts:
#	packages/core/core/src/public/Asset.js
#	packages/core/core/src/public/Dependency.js
@@ -123,7 +124,55 @@ class BaseAsset {
}

get meta(): Meta {
return this.#asset.value.meta;
return new Proxy(this.#asset.value.meta, {
Copy link
Contributor

Choose a reason for hiding this comment

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

It is possible the use of proxies offsets any improvement this would have as far as runtime is concerned

Copy link
Member Author

@devongovett devongovett Apr 23, 2024

Choose a reason for hiding this comment

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

The main goal of this PR is to reduce the size of these data structures, in memory and when serialized, and also align them with how a representation could work in Rust. I don't think there should be much difference in performance in terms of time. This came from the ParcelDB branch where I believe Atlassian saw a fairly significant performance improvement though (likely not because of this in particular but it's a good sign). But if you have a better idea on how to implement this backwards compatibility let me know.

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