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

Kotlin, non-builder: chunk redact function every 100 fields #3214

Merged
merged 5 commits into from
Dec 13, 2024

Conversation

damianw
Copy link
Contributor

@damianw damianw commented Dec 12, 2024

This adds a workaround to an issue discussed in #1448, where the generated redact function is too large to be compiled.

It's much more likely to hit this issue with redact than the other functions because of KT-73789, which results in methods which are significantly longer than necessary specifically due to the repeated ?.let construction.

@damianw damianw mentioned this pull request Dec 12, 2024
12 tasks
Copy link
Member

@oldergod oldergod left a comment

Choose a reason for hiding this comment

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

thank you for the fix!
I've replaced the test with a golden file which will also confirm compilation is good.
And did a quick refactor so that we clearly see the sequential mutation.

override fun redact(`value`: HundredsFields): HundredsFields {
  var result = redact0(`value`)
  result = redact1(result)
  result = redact2(result)
  return result
}

I thought about writing something like return redact2(redact1(redact0(value)))) but that didn't come as straight forward and I'm sure someone with thousands of fields will say it sucks.

@oldergod oldergod enabled auto-merge (squash) December 13, 2024 09:19
@oldergod oldergod merged commit 65c1bca into square:master Dec 13, 2024
11 checks passed
@damianw damianw deleted the optimize-redact branch December 13, 2024 21:12
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