Skip to content

Perf optimization v3#307

Merged
mgramigna merged 46 commits into
nextfrom
perf-optimization-v3
Jan 16, 2023
Merged

Perf optimization v3#307
mgramigna merged 46 commits into
nextfrom
perf-optimization-v3

Conversation

@birick1
Copy link
Copy Markdown
Contributor

@birick1 birick1 commented Jan 15, 2023

This pull request supersedes #278 as it has been rebased to the next branch. The decision was made that rebasing to the next branch would be the appropriate way to promote to production.

Closes #278

Pull requests into cql-execution require the following.
Submitter and reviewer should ✔ when done.
For items that are not-applicable, mark "N/A" and ✔.

CDS Connect and Bonnie are the main users of this repository.
It is strongly recommended to include a person from each of those projects as a reviewer.

Submitter:

  • [ X] This pull request describes why these changes were made
  • [ X] Code diff has been done and been reviewed (it does not contain: additional white space, not applicable code changes, debug statements, etc.)
  • [ X] Tests are included and test edge cases
  • [ X] Tests have been run locally and pass
  • [ X] Code coverage has not gone down and all code touched or added is covered.
  • [ X] Code passes lint and prettier (hint: use npm run test:plus to run tests, lint, and prettier)
  • [ X] All dependent libraries are appropriately updated or have a corresponding PR related to this change
  • [ X] cql4browsers.js built with npm run build:browserify if source changed.

Reviewer:

Name:

  • Code is maintainable and reusable, reuses existing code and infrastructure where appropriate, and accomplishes the task’s purpose
  • The tests appropriately test the new code, including edge cases
  • You have tried to break the code

birick1 and others added 30 commits January 15, 2023 16:58
…mparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests
…mparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests
…ove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty
…ect (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest
@birick1 birick1 requested review from cmoesel and mgramigna January 15, 2023 23:30
@cmoesel cmoesel changed the base branch from master to next January 15, 2023 23:31
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #307 (adc9429) into next (9f57a0c) will decrease coverage by 0.04%.
The diff coverage is 81.05%.

@@            Coverage Diff             @@
##             next     #307      +/-   ##
==========================================
- Coverage   86.13%   86.09%   -0.05%     
==========================================
  Files          50       51       +1     
  Lines        4427     4486      +59     
  Branches     1245     1265      +20     
==========================================
+ Hits         3813     3862      +49     
- Misses        321      324       +3     
- Partials      293      300       +7     
Impacted Files Coverage Δ
src/cql-patient.ts 77.41% <0.00%> (-1.27%) ⬇️
src/datatypes/uncertainty.ts 80.59% <66.66%> (+2.63%) ⬆️
src/util/immutableUtil.ts 79.16% <79.16%> (ø)
src/elm/list.ts 96.15% <100.00%> (-0.60%) ⬇️
src/elm/query.ts 90.38% <100.00%> (-0.36%) ⬇️
src/runtime/context.ts 81.02% <100.00%> (ø)
src/util/util.ts 80.70% <100.00%> (+0.34%) ⬆️
src/util/comparison.ts 99.18% <0.00%> (+1.62%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mgramigna mgramigna mentioned this pull request Jan 15, 2023
11 tasks
Copy link
Copy Markdown
Member

@cmoesel cmoesel left a comment

Choose a reason for hiding this comment

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

This looks very good. Not only does it improve performance, but it also fixes a few inconsistencies and improves support on Windows. Thanks, @birick1. This is a great PR!

@mgramigna mgramigna merged commit f5671f6 into next Jan 16, 2023
@mgramigna mgramigna deleted the perf-optimization-v3 branch January 16, 2023 00:04
cmoesel added a commit that referenced this pull request Jan 16, 2023
The main motivation of this pull request is to introduce a targeted performance improvement to list operations. The list and query distinct operations are non-performant on large lists which do occur in real-world use. These performance issues are resolved by using normalized immutable objects (with the Immutable.js library) as keys (or hashes) optimized for value comparisons.

In implementing the performance improvements, an issue was identified with the Uncertainty type where point equality with other types was not commutative. This could produce unexpected behavior based on the order in which Uncertain points were compared. This is corrected and tests added (thanks @hossenlopp / @cmoesel for constructor.name improvement suggestions).

All Commits:

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add ESLint curly rule for if {}; Fix nonconformant if statements; Remove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty

* Resolve cql4broswers, eslint, and prettier issues

* Using 'has' has better performance

* Change type checks in uncertainty; Add test to distinguish possible solutions

* Update test comment

* Change normalization to use fixed names where possible

* Change normalization to use constructor (instead of constructor.name)

* Add a _typeHierarchy check in normalization for model objects

* Reword comment.

* Rename memoizer.ts; Simplify; Update descriptions.

* Fix Context.childContext(null) to default to empty context_values object (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest

* v2.4.3 (#284)

* Re-up to package lock v2 after merge from master

* Update build:test-data, build:spec-test-data, and watch:test-data scripts to run in Windows env too

* Resolve npm security vulnerability via audit

* Return doExcept and doIntersect to original implementations; Remove toKvp and toKvpParams in immutableUtil

* Revert doUnion

* Update cql4browsers post doUnion reversion

* Prettier spacing

* Update var names to reflect change from kvp to just keys

* Correct build/watch scripts for windows/mac

* Replace the toDistinctList implementation with in query.ts with list.ts implementation; Rename

* Add .version/.display for normalized key for codes

* Update test name

* Add description for immutableUtil

* Revert .eslintrc.js to .eslintrc.json removing the linebreak rule but keeping curly rule

* Browserify, lint, prettier update post changes

* Post Rebase Corrections

* Matt/Chris Review updates

* Resolve commit issues

Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
mgramigna pushed a commit that referenced this pull request Jan 16, 2023
The main motivation of this pull request is to introduce a targeted performance improvement to list operations. The list and query distinct operations are non-performant on large lists which do occur in real-world use. These performance issues are resolved by using normalized immutable objects (with the Immutable.js library) as keys (or hashes) optimized for value comparisons.

In implementing the performance improvements, an issue was identified with the Uncertainty type where point equality with other types was not commutative. This could produce unexpected behavior based on the order in which Uncertain points were compared. This is corrected and tests added (thanks @hossenlopp / @cmoesel for constructor.name improvement suggestions).

All Commits:

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add ESLint curly rule for if {}; Fix nonconformant if statements; Remove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty

* Resolve cql4broswers, eslint, and prettier issues

* Using 'has' has better performance

* Change type checks in uncertainty; Add test to distinguish possible solutions

* Update test comment

* Change normalization to use fixed names where possible

* Change normalization to use constructor (instead of constructor.name)

* Add a _typeHierarchy check in normalization for model objects

* Reword comment.

* Rename memoizer.ts; Simplify; Update descriptions.

* Fix Context.childContext(null) to default to empty context_values object (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest

* v2.4.3 (#284)

* Re-up to package lock v2 after merge from master

* Update build:test-data, build:spec-test-data, and watch:test-data scripts to run in Windows env too

* Resolve npm security vulnerability via audit

* Return doExcept and doIntersect to original implementations; Remove toKvp and toKvpParams in immutableUtil

* Revert doUnion

* Update cql4browsers post doUnion reversion

* Prettier spacing

* Update var names to reflect change from kvp to just keys

* Correct build/watch scripts for windows/mac

* Replace the toDistinctList implementation with in query.ts with list.ts implementation; Rename

* Add .version/.display for normalized key for codes

* Update test name

* Add description for immutableUtil

* Revert .eslintrc.js to .eslintrc.json removing the linebreak rule but keeping curly rule

* Browserify, lint, prettier update post changes

* Post Rebase Corrections

* Matt/Chris Review updates

* Resolve commit issues

Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
mgramigna pushed a commit that referenced this pull request Jan 16, 2023
The main motivation of this pull request is to introduce a targeted performance improvement to list operations. The list and query distinct operations are non-performant on large lists which do occur in real-world use. These performance issues are resolved by using normalized immutable objects (with the Immutable.js library) as keys (or hashes) optimized for value comparisons.

In implementing the performance improvements, an issue was identified with the Uncertainty type where point equality with other types was not commutative. This could produce unexpected behavior based on the order in which Uncertain points were compared. This is corrected and tests added (thanks @hossenlopp / @cmoesel for constructor.name improvement suggestions).

All Commits:

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add ESLint curly rule for if {}; Fix nonconformant if statements; Remove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty

* Resolve cql4broswers, eslint, and prettier issues

* Using 'has' has better performance

* Change type checks in uncertainty; Add test to distinguish possible solutions

* Update test comment

* Change normalization to use fixed names where possible

* Change normalization to use constructor (instead of constructor.name)

* Add a _typeHierarchy check in normalization for model objects

* Reword comment.

* Rename memoizer.ts; Simplify; Update descriptions.

* Fix Context.childContext(null) to default to empty context_values object (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest

* v2.4.3 (#284)

* Re-up to package lock v2 after merge from master

* Update build:test-data, build:spec-test-data, and watch:test-data scripts to run in Windows env too

* Resolve npm security vulnerability via audit

* Return doExcept and doIntersect to original implementations; Remove toKvp and toKvpParams in immutableUtil

* Revert doUnion

* Update cql4browsers post doUnion reversion

* Prettier spacing

* Update var names to reflect change from kvp to just keys

* Correct build/watch scripts for windows/mac

* Replace the toDistinctList implementation with in query.ts with list.ts implementation; Rename

* Add .version/.display for normalized key for codes

* Update test name

* Add description for immutableUtil

* Revert .eslintrc.js to .eslintrc.json removing the linebreak rule but keeping curly rule

* Browserify, lint, prettier update post changes

* Post Rebase Corrections

* Matt/Chris Review updates

* Resolve commit issues

Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
mgramigna pushed a commit that referenced this pull request Mar 27, 2023
The main motivation of this pull request is to introduce a targeted performance improvement to list operations. The list and query distinct operations are non-performant on large lists which do occur in real-world use. These performance issues are resolved by using normalized immutable objects (with the Immutable.js library) as keys (or hashes) optimized for value comparisons.

In implementing the performance improvements, an issue was identified with the Uncertainty type where point equality with other types was not commutative. This could produce unexpected behavior based on the order in which Uncertain points were compared. This is corrected and tests added (thanks @hossenlopp / @cmoesel for constructor.name improvement suggestions).

All Commits:

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add ESLint curly rule for if {}; Fix nonconformant if statements; Remove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty

* Resolve cql4broswers, eslint, and prettier issues

* Using 'has' has better performance

* Change type checks in uncertainty; Add test to distinguish possible solutions

* Update test comment

* Change normalization to use fixed names where possible

* Change normalization to use constructor (instead of constructor.name)

* Add a _typeHierarchy check in normalization for model objects

* Reword comment.

* Rename memoizer.ts; Simplify; Update descriptions.

* Fix Context.childContext(null) to default to empty context_values object (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest

* v2.4.3 (#284)

* Re-up to package lock v2 after merge from master

* Update build:test-data, build:spec-test-data, and watch:test-data scripts to run in Windows env too

* Resolve npm security vulnerability via audit

* Return doExcept and doIntersect to original implementations; Remove toKvp and toKvpParams in immutableUtil

* Revert doUnion

* Update cql4browsers post doUnion reversion

* Prettier spacing

* Update var names to reflect change from kvp to just keys

* Correct build/watch scripts for windows/mac

* Replace the toDistinctList implementation with in query.ts with list.ts implementation; Rename

* Add .version/.display for normalized key for codes

* Update test name

* Add description for immutableUtil

* Revert .eslintrc.js to .eslintrc.json removing the linebreak rule but keeping curly rule

* Browserify, lint, prettier update post changes

* Post Rebase Corrections

* Matt/Chris Review updates

* Resolve commit issues

Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
mgramigna pushed a commit that referenced this pull request Mar 27, 2023
The main motivation of this pull request is to introduce a targeted performance improvement to list operations. The list and query distinct operations are non-performant on large lists which do occur in real-world use. These performance issues are resolved by using normalized immutable objects (with the Immutable.js library) as keys (or hashes) optimized for value comparisons.

In implementing the performance improvements, an issue was identified with the Uncertainty type where point equality with other types was not commutative. This could produce unexpected behavior based on the order in which Uncertain points were compared. This is corrected and tests added (thanks @hossenlopp / @cmoesel for constructor.name improvement suggestions).

All Commits:

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add ESLint curly rule for if {}; Fix nonconformant if statements; Remove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty

* Resolve cql4broswers, eslint, and prettier issues

* Using 'has' has better performance

* Change type checks in uncertainty; Add test to distinguish possible solutions

* Update test comment

* Change normalization to use fixed names where possible

* Change normalization to use constructor (instead of constructor.name)

* Add a _typeHierarchy check in normalization for model objects

* Reword comment.

* Rename memoizer.ts; Simplify; Update descriptions.

* Fix Context.childContext(null) to default to empty context_values object (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest

* v2.4.3 (#284)

* Re-up to package lock v2 after merge from master

* Update build:test-data, build:spec-test-data, and watch:test-data scripts to run in Windows env too

* Resolve npm security vulnerability via audit

* Return doExcept and doIntersect to original implementations; Remove toKvp and toKvpParams in immutableUtil

* Revert doUnion

* Update cql4browsers post doUnion reversion

* Prettier spacing

* Update var names to reflect change from kvp to just keys

* Correct build/watch scripts for windows/mac

* Replace the toDistinctList implementation with in query.ts with list.ts implementation; Rename

* Add .version/.display for normalized key for codes

* Update test name

* Add description for immutableUtil

* Revert .eslintrc.js to .eslintrc.json removing the linebreak rule but keeping curly rule

* Browserify, lint, prettier update post changes

* Post Rebase Corrections

* Matt/Chris Review updates

* Resolve commit issues

Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
mgramigna pushed a commit that referenced this pull request Mar 27, 2023
The main motivation of this pull request is to introduce a targeted performance improvement to list operations. The list and query distinct operations are non-performant on large lists which do occur in real-world use. These performance issues are resolved by using normalized immutable objects (with the Immutable.js library) as keys (or hashes) optimized for value comparisons.

In implementing the performance improvements, an issue was identified with the Uncertainty type where point equality with other types was not commutative. This could produce unexpected behavior based on the order in which Uncertain points were compared. This is corrected and tests added (thanks @hossenlopp / @cmoesel for constructor.name improvement suggestions).

All Commits:

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add ESLint curly rule for if {}; Fix nonconformant if statements; Remove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty

* Resolve cql4broswers, eslint, and prettier issues

* Using 'has' has better performance

* Change type checks in uncertainty; Add test to distinguish possible solutions

* Update test comment

* Change normalization to use fixed names where possible

* Change normalization to use constructor (instead of constructor.name)

* Add a _typeHierarchy check in normalization for model objects

* Reword comment.

* Rename memoizer.ts; Simplify; Update descriptions.

* Fix Context.childContext(null) to default to empty context_values object (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest

* v2.4.3 (#284)

* Re-up to package lock v2 after merge from master

* Update build:test-data, build:spec-test-data, and watch:test-data scripts to run in Windows env too

* Resolve npm security vulnerability via audit

* Return doExcept and doIntersect to original implementations; Remove toKvp and toKvpParams in immutableUtil

* Revert doUnion

* Update cql4browsers post doUnion reversion

* Prettier spacing

* Update var names to reflect change from kvp to just keys

* Correct build/watch scripts for windows/mac

* Replace the toDistinctList implementation with in query.ts with list.ts implementation; Rename

* Add .version/.display for normalized key for codes

* Update test name

* Add description for immutableUtil

* Revert .eslintrc.js to .eslintrc.json removing the linebreak rule but keeping curly rule

* Browserify, lint, prettier update post changes

* Post Rebase Corrections

* Matt/Chris Review updates

* Resolve commit issues

Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
mgramigna pushed a commit that referenced this pull request Mar 28, 2023
The main motivation of this pull request is to introduce a targeted performance improvement to list operations. The list and query distinct operations are non-performant on large lists which do occur in real-world use. These performance issues are resolved by using normalized immutable objects (with the Immutable.js library) as keys (or hashes) optimized for value comparisons.

In implementing the performance improvements, an issue was identified with the Uncertainty type where point equality with other types was not commutative. This could produce unexpected behavior based on the order in which Uncertain points were compared. This is corrected and tests added (thanks @hossenlopp / @cmoesel for constructor.name improvement suggestions).

All Commits:

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add ESLint curly rule for if {}; Fix nonconformant if statements; Remove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty

* Resolve cql4broswers, eslint, and prettier issues

* Using 'has' has better performance

* Change type checks in uncertainty; Add test to distinguish possible solutions

* Update test comment

* Change normalization to use fixed names where possible

* Change normalization to use constructor (instead of constructor.name)

* Add a _typeHierarchy check in normalization for model objects

* Reword comment.

* Rename memoizer.ts; Simplify; Update descriptions.

* Fix Context.childContext(null) to default to empty context_values object (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest

* v2.4.3 (#284)

* Re-up to package lock v2 after merge from master

* Update build:test-data, build:spec-test-data, and watch:test-data scripts to run in Windows env too

* Resolve npm security vulnerability via audit

* Return doExcept and doIntersect to original implementations; Remove toKvp and toKvpParams in immutableUtil

* Revert doUnion

* Update cql4browsers post doUnion reversion

* Prettier spacing

* Update var names to reflect change from kvp to just keys

* Correct build/watch scripts for windows/mac

* Replace the toDistinctList implementation with in query.ts with list.ts implementation; Rename

* Add .version/.display for normalized key for codes

* Update test name

* Add description for immutableUtil

* Revert .eslintrc.js to .eslintrc.json removing the linebreak rule but keeping curly rule

* Browserify, lint, prettier update post changes

* Post Rebase Corrections

* Matt/Chris Review updates

* Resolve commit issues

Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
mgramigna pushed a commit that referenced this pull request Mar 29, 2023
The main motivation of this pull request is to introduce a targeted performance improvement to list operations. The list and query distinct operations are non-performant on large lists which do occur in real-world use. These performance issues are resolved by using normalized immutable objects (with the Immutable.js library) as keys (or hashes) optimized for value comparisons.

In implementing the performance improvements, an issue was identified with the Uncertainty type where point equality with other types was not commutative. This could produce unexpected behavior based on the order in which Uncertain points were compared. This is corrected and tests added (thanks @hossenlopp / @cmoesel for constructor.name improvement suggestions).

All Commits:

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add ESLint curly rule for if {}; Fix nonconformant if statements; Remove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty

* Resolve cql4broswers, eslint, and prettier issues

* Using 'has' has better performance

* Change type checks in uncertainty; Add test to distinguish possible solutions

* Update test comment

* Change normalization to use fixed names where possible

* Change normalization to use constructor (instead of constructor.name)

* Add a _typeHierarchy check in normalization for model objects

* Reword comment.

* Rename memoizer.ts; Simplify; Update descriptions.

* Fix Context.childContext(null) to default to empty context_values object (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest

* v2.4.3 (#284)

* Re-up to package lock v2 after merge from master

* Update build:test-data, build:spec-test-data, and watch:test-data scripts to run in Windows env too

* Resolve npm security vulnerability via audit

* Return doExcept and doIntersect to original implementations; Remove toKvp and toKvpParams in immutableUtil

* Revert doUnion

* Update cql4browsers post doUnion reversion

* Prettier spacing

* Update var names to reflect change from kvp to just keys

* Correct build/watch scripts for windows/mac

* Replace the toDistinctList implementation with in query.ts with list.ts implementation; Rename

* Add .version/.display for normalized key for codes

* Update test name

* Add description for immutableUtil

* Revert .eslintrc.js to .eslintrc.json removing the linebreak rule but keeping curly rule

* Browserify, lint, prettier update post changes

* Post Rebase Corrections

* Matt/Chris Review updates

* Resolve commit issues

Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
mgramigna pushed a commit that referenced this pull request Apr 21, 2023
The main motivation of this pull request is to introduce a targeted performance improvement to list operations. The list and query distinct operations are non-performant on large lists which do occur in real-world use. These performance issues are resolved by using normalized immutable objects (with the Immutable.js library) as keys (or hashes) optimized for value comparisons.

In implementing the performance improvements, an issue was identified with the Uncertainty type where point equality with other types was not commutative. This could produce unexpected behavior based on the order in which Uncertain points were compared. This is corrected and tests added (thanks @hossenlopp / @cmoesel for constructor.name improvement suggestions).

All Commits:

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add ESLint curly rule for if {}; Fix nonconformant if statements; Remove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty

* Resolve cql4broswers, eslint, and prettier issues

* Using 'has' has better performance

* Change type checks in uncertainty; Add test to distinguish possible solutions

* Update test comment

* Change normalization to use fixed names where possible

* Change normalization to use constructor (instead of constructor.name)

* Add a _typeHierarchy check in normalization for model objects

* Reword comment.

* Rename memoizer.ts; Simplify; Update descriptions.

* Fix Context.childContext(null) to default to empty context_values object (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest

* v2.4.3 (#284)

* Re-up to package lock v2 after merge from master

* Update build:test-data, build:spec-test-data, and watch:test-data scripts to run in Windows env too

* Resolve npm security vulnerability via audit

* Return doExcept and doIntersect to original implementations; Remove toKvp and toKvpParams in immutableUtil

* Revert doUnion

* Update cql4browsers post doUnion reversion

* Prettier spacing

* Update var names to reflect change from kvp to just keys

* Correct build/watch scripts for windows/mac

* Replace the toDistinctList implementation with in query.ts with list.ts implementation; Rename

* Add .version/.display for normalized key for codes

* Update test name

* Add description for immutableUtil

* Revert .eslintrc.js to .eslintrc.json removing the linebreak rule but keeping curly rule

* Browserify, lint, prettier update post changes

* Post Rebase Corrections

* Matt/Chris Review updates

* Resolve commit issues

Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
cmoesel added a commit that referenced this pull request May 4, 2023
The main motivation of this pull request is to introduce a targeted performance improvement to list operations. The list and query distinct operations are non-performant on large lists which do occur in real-world use. These performance issues are resolved by using normalized immutable objects (with the Immutable.js library) as keys (or hashes) optimized for value comparisons.

In implementing the performance improvements, an issue was identified with the Uncertainty type where point equality with other types was not commutative. This could produce unexpected behavior based on the order in which Uncertain points were compared. This is corrected and tests added (thanks @hossenlopp / @cmoesel for constructor.name improvement suggestions).

All Commits:

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add ESLint curly rule for if {}; Fix nonconformant if statements; Remove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty

* Resolve cql4broswers, eslint, and prettier issues

* Using 'has' has better performance

* Change type checks in uncertainty; Add test to distinguish possible solutions

* Update test comment

* Change normalization to use fixed names where possible

* Change normalization to use constructor (instead of constructor.name)

* Add a _typeHierarchy check in normalization for model objects

* Reword comment.

* Rename memoizer.ts; Simplify; Update descriptions.

* Fix Context.childContext(null) to default to empty context_values object (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest

* v2.4.3 (#284)

* Re-up to package lock v2 after merge from master

* Update build:test-data, build:spec-test-data, and watch:test-data scripts to run in Windows env too

* Resolve npm security vulnerability via audit

* Return doExcept and doIntersect to original implementations; Remove toKvp and toKvpParams in immutableUtil

* Revert doUnion

* Update cql4browsers post doUnion reversion

* Prettier spacing

* Update var names to reflect change from kvp to just keys

* Correct build/watch scripts for windows/mac

* Replace the toDistinctList implementation with in query.ts with list.ts implementation; Rename

* Add .version/.display for normalized key for codes

* Update test name

* Add description for immutableUtil

* Revert .eslintrc.js to .eslintrc.json removing the linebreak rule but keeping curly rule

* Browserify, lint, prettier update post changes

* Post Rebase Corrections

* Matt/Chris Review updates

* Resolve commit issues

Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
cmoesel added a commit that referenced this pull request May 4, 2023
The main motivation of this pull request is to introduce a targeted performance improvement to list operations. The list and query distinct operations are non-performant on large lists which do occur in real-world use. These performance issues are resolved by using normalized immutable objects (with the Immutable.js library) as keys (or hashes) optimized for value comparisons.

In implementing the performance improvements, an issue was identified with the Uncertainty type where point equality with other types was not commutative. This could produce unexpected behavior based on the order in which Uncertain points were compared. This is corrected and tests added (thanks @hossenlopp / @cmoesel for constructor.name improvement suggestions).

All Commits:

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add cross-env dependency for cross-platform test support; Update package-lock to v2 (npm 7+)

* Fix a number of Typescript errors for test files using @ts-nocheck; Fix broken tests

* Update Uncertainty to account for different types/constructors for comparison; Update Uncertainty.equals to account for point behavior; Add Uncertainty tests

* Focused performance improvements for lists (doDistinct, doExcept, doIntersect) and queries (toDistinctList)

* Resolve ESLint issues in Windows; Resolve ESLint and Prettier issues;

* Correct wrong ESLint update for eslintrc.js

* Update cql4browsers.js

* Update ESLint config to use ecmaVersion 8 to align with es2017 update

* Add ESLint curly rule for if {}; Fix nonconformant if statements; Remove redundant IMemoizeOptions; Remove unnecessary instanceof Uncertainty

* Resolve cql4broswers, eslint, and prettier issues

* Using 'has' has better performance

* Change type checks in uncertainty; Add test to distinguish possible solutions

* Update test comment

* Change normalization to use fixed names where possible

* Change normalization to use constructor (instead of constructor.name)

* Add a _typeHierarchy check in normalization for model objects

* Reword comment.

* Rename memoizer.ts; Simplify; Update descriptions.

* Fix Context.childContext(null) to default to empty context_values object (#282)

* Fix Context.childContext to default to {} on undefined AND null

Fixes #277

* Context type updates & UnfilteredContext bug fix

Updated Context constructor to indicate that a Library can be passed in as the parent.  Updated PatientContext and UnfilteredContext library property to indicate it is, in fact, a Library. In the process of doing this, discovered code that was looking for expression identifiers at the root of the Library object instead of Library.expressions.  Oops!  Fixed it.

* Upgrade gradle wrapper

* npm audit fix + npm install --save-dev mocha@latest

* v2.4.3 (#284)

* Re-up to package lock v2 after merge from master

* Update build:test-data, build:spec-test-data, and watch:test-data scripts to run in Windows env too

* Resolve npm security vulnerability via audit

* Return doExcept and doIntersect to original implementations; Remove toKvp and toKvpParams in immutableUtil

* Revert doUnion

* Update cql4browsers post doUnion reversion

* Prettier spacing

* Update var names to reflect change from kvp to just keys

* Correct build/watch scripts for windows/mac

* Replace the toDistinctList implementation with in query.ts with list.ts implementation; Rename

* Add .version/.display for normalized key for codes

* Update test name

* Add description for immutableUtil

* Revert .eslintrc.js to .eslintrc.json removing the linebreak rule but keeping curly rule

* Browserify, lint, prettier update post changes

* Post Rebase Corrections

* Matt/Chris Review updates

* Resolve commit issues

Co-authored-by: Chris Moesel <cmoesel@users.noreply.github.com>
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.

4 participants