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

FastProtocolBridge #2106

Merged
merged 8 commits into from
Jun 14, 2024
Merged

FastProtocolBridge #2106

merged 8 commits into from
Jun 14, 2024

Conversation

swankjesse
Copy link
Collaborator

@swankjesse swankjesse commented Jun 12, 2024

This is a new implementation of ProtocolBridge that uses Zipline's new asDynamicFunction() API. It's dramatically faster - in one measurement we went from spending ~18% of our samples on serialization to ~3% of our samples.

private lateinit var changesSinkService: ChangesSinkService
private lateinit var sendChanges: (service: ChangesSinkService, args: List<*>) -> Any?

public override val widgetSystem: WidgetSystem<Unit> =
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Too much duplication here!

): ProtocolBridge = FastProtocolBridge(json, hostVersion, widgetSystemFactory, mismatchHandler)

@OptIn(RedwoodCodegenApi::class)
private class FastProtocolBridge(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I super dislike this name, but I super don't care when private!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can fix!

Base automatically changed from jwilson.0612.state_bridge to trunk June 13, 2024 21:54
@swankjesse swankjesse marked this pull request as ready for review June 13, 2024 21:54
@swankjesse swankjesse changed the title WIP: FastProtocolBridge FastProtocolBridge Jun 13, 2024
* Confirm that [FastProtocolBridge] behaves the same as [DefaultProtocolBridge].
*/
@OptIn(ExperimentalSerializationApi::class, RedwoodCodegenApi::class)
class FastProtocolBridgeTest {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FYI @JakeWharton this is new!

id: Id,
tag: PropertyTag,
value: UInt,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is new! And it’s quite unfortunate!

I don’t think we need to implement something general purpose for other kotlinx.serialization types. UInt is something we’re already using in Cash App, so we’re pinned here.

@swankjesse swankjesse changed the base branch from trunk to jwilson.0613.zipline_112 June 14, 2024 02:17
This is a new implementation of ProtocolBridge that uses
Zipline's new asDynamicFunction() API. It's dramatically
faster - in one measurement we went from spending ~18% of
our samples on serialization to ~3% of our samples.
Base automatically changed from jwilson.0613.zipline_112 to trunk June 14, 2024 03:00
@swankjesse swankjesse merged commit 2b6027c into trunk Jun 14, 2024
9 of 11 checks passed
@swankjesse swankjesse deleted the jwilson.0612.fast_bridge branch June 14, 2024 11:22
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.

3 participants