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

Data analysts should be able to use Text.replace to substitute parts of the text #3393

Merged
merged 16 commits into from
Apr 13, 2022

Conversation

radeusgd
Copy link
Member

@radeusgd radeusgd commented Apr 12, 2022

Pull Request Description

Implements https://www.pivotaltracker.com/story/show/181266274

Important Notes

Checklist

Please include the following checklist in your PR:

  • The documentation has been updated if necessary.
  • All code conforms to the Scala, Java, and Rust style guides.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed: Enso GUI was tested when built using BOTH ./run dist and ./run watch.

@radeusgd radeusgd self-assigned this Apr 12, 2022
@radeusgd radeusgd force-pushed the wip/radeusgd/text-replace-181266274 branch 2 times, most recently from ea9240d to 27d4f78 Compare April 12, 2022 16:11
@radeusgd radeusgd marked this pull request as ready for review April 12, 2022 16:13
@radeusgd radeusgd requested review from 4e6 and jdunkerley as code owners April 12, 2022 16:13
Comment on lines +126 to +127
IntArrayBuilder codeunit_start_mapping = new IntArrayBuilder(charSequence.length() + 1);
IntArrayBuilder codeunit_end_mapping = new IntArrayBuilder(charSequence.length() + 1);
Copy link
Member Author

Choose a reason for hiding this comment

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

These two additional mappings are used in replace but not in location_of.
For simplicity I always compute them - this is just creating 2 additional arrays along with the third one that is always created, so the cost shouldn't be awful. I prefer to keep it this way for simplicity instead of maintaining two pieces of code that do the same thing (which is prone to desynchronization).

Still, if anyone thinks that it's worth cutting the extra cost, I can make it into two separate functions. I just thought it is a premature optimization and decided to go for more readable code - we can always revisit it when we will have performance issues with Text and approach this correctly with comparative benchmarks instead of my gut instinct of what is important for perf. and what is not.

@radeusgd radeusgd force-pushed the wip/radeusgd/text-replace-181266274 branch from 4458478 to 1ef58cc Compare April 13, 2022 12:53
Copy link
Member

@jdunkerley jdunkerley left a comment

Choose a reason for hiding this comment

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

Couple of minor things but other wise LGTM

@radeusgd radeusgd added the CI: Ready to merge This PR is eligible for automatic merge label Apr 13, 2022
@mergify mergify bot merged commit 0ea5dc2 into develop Apr 13, 2022
@mergify mergify bot deleted the wip/radeusgd/text-replace-181266274 branch April 13, 2022 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants