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

Random function: Iterate over sequence of characters, not positions #1163

Merged
merged 1 commit into from
Mar 29, 2022

Conversation

galtm
Copy link
Contributor

@galtm galtm commented Mar 9, 2022

Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.

Committer Notes

This PR simplifies some code inside a function.

This PR is not urgent, so no worries if the team can't review it for a while.

Acceleration wasn't an explicit requirement, but I used measure-time="true" in an ad hoc XSpec file running in Oxygen to compare the speed of the original and modified functions. The modified function here is slightly faster, e.g., 6% or 8% less time to generate 100,000 strings of length 100 each.

All Submissions:

  • Have you selected the correct base branch per Contributing guidance?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you squashed any non-relevant commits and commit messages? [instructions]
  • Do all automated CI/CD checks pass?

This is not a core feature.

Changes to Core Features:

  • [ ] Have you added an explanation of what your changes do and why you'd like us to include them?
  • [ ] Have you written new tests for your core changes, as applicable?
  • [ ] Have you included examples of how to use your new feature(s)?
  • [ ] Have you updated all OSCAL website and readme documentation affected by the changes you made? Changes to the OSCAL website can be made in the docs/content directory of your branch.

Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
Copy link
Contributor

@wendellpiez wendellpiez left a comment

Choose a reason for hiding this comment

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

Unit testing 🏅 great stuff @galtm

Copy link
Contributor

@david-waltermire david-waltermire left a comment

Choose a reason for hiding this comment

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

Thanks @galtm !

@david-waltermire david-waltermire merged commit e00da79 into usnistgov:develop Mar 29, 2022
@galtm galtm deleted the char-transform branch April 17, 2022 15:53
@david-waltermire david-waltermire added this to the OSCAL 1.1.0 milestone May 4, 2022
david-waltermire pushed a commit that referenced this pull request May 17, 2022
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
david-waltermire pushed a commit that referenced this pull request Jun 21, 2022
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
david-waltermire pushed a commit that referenced this pull request Jul 13, 2022
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
david-waltermire pushed a commit that referenced this pull request Aug 23, 2022
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
aj-stein-nist pushed a commit to aj-stein-nist/OSCAL-forked that referenced this pull request Oct 6, 2022
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
aj-stein-nist pushed a commit that referenced this pull request Oct 18, 2022
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
david-waltermire pushed a commit that referenced this pull request Oct 31, 2022
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
aj-stein-nist pushed a commit to aj-stein-nist/OSCAL-forked that referenced this pull request Jan 10, 2023
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
aj-stein-nist pushed a commit to aj-stein-nist/OSCAL-forked that referenced this pull request Feb 6, 2023
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
aj-stein-nist pushed a commit to aj-stein-nist/OSCAL-forked that referenced this pull request Jun 29, 2023
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
aj-stein-nist pushed a commit to aj-stein-nist/OSCAL-forked that referenced this pull request Jul 10, 2023
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
aj-stein-nist pushed a commit to galtm/OSCAL that referenced this pull request Sep 28, 2023
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
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