Skip to content

Conversation

Lord-McSweeney
Copy link
Collaborator

@Lord-McSweeney Lord-McSweeney commented Sep 11, 2025

This should make separating AVM2 from core slightly easier in the future, if we ever do it. This also reduces compile times slightly, especially when re-building after modifying core code.

The only downside of this that I can see is that without LTO, some functions from avm_string might not get inlined in core. However, those functions don't seem to be very hot, so this is probably fine.

@Lord-McSweeney Lord-McSweeney added A-other Area: Not covered by other area labels T-refactor Type: Refactor / Cleanup labels Sep 11, 2025
@kjarosh
Copy link
Member

kjarosh commented Sep 11, 2025

The idea of separating avm string to its own crate sounds good, but I'd say we 100% have to do benchmarks and make sure it doesn't affect performance negatively.

@Lord-McSweeney
Copy link
Collaborator Author

I don't see any performance impact from this change (on microbenchmarks for string indexing and concatenation) and I see a ~2 second speedup in recompiling core, so I think this is okay on the performance side.

@Lord-McSweeney Lord-McSweeney added the waiting-on-review Waiting on review from a Ruffle team member label Sep 11, 2025
@Lord-McSweeney Lord-McSweeney changed the title chore: Move AvmString code into its own crate chore: Move AvmString code into a new crate Sep 12, 2025
Copy link
Contributor

@moulins moulins left a comment

Choose a reason for hiding this comment

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

LGTM, but this is a significant architectural change (especially if we expect ruffle_common to grow in the future, e.g. by moving HasPrefixField there) so a second opinion would be best.

pub use common::CommonStrings;
pub use context::{HasStringContext, StringContext};
pub use interner::{AvmAtom, AvmStringInterner};
use ruffle_wstr::{from_utf8, WStr, WString};
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd keep the other reexports (now from ruffle_common::avm_string), to avoid having to update the use statements everywhere else.

In the future, we can move other types shared across the AVMs and core player to this crate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-other Area: Not covered by other area labels T-refactor Type: Refactor / Cleanup waiting-on-review Waiting on review from a Ruffle team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants