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

FLAG-69: Improve the performance of patient flag evaluation #59

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ManojLL
Copy link
Contributor

@ManojLL ManojLL commented Jun 11, 2024

Description of what I change

change to evaluate patient flags in parallely on generateFlagsForPatient(...) method.

Issue Worked On

worked on FLAG-69

Test

use the method execution time in milliseconds (ms) to evaluate the performance.
Generate flags for patient

Generate flags for patient
parallel process -> 7.6.5.8,7,7,6,7,8,6 => avg 6.7 milliseconds

current module -> 8,7,7,6,8,7,7,7,8,6 => avg 7.1 milliseconds

flags count < 5 - current module perform better than this implementations
flags count < 10 - both are perform in same way
flags count = 17 - this implementation perform better than current module

when the flag count is increased, the prell process performs better than the current module.

method test : generate flags for patient : FalgServiceImpl.generateFlagsForPatient(Patient patient, Context)

@ManojLL ManojLL marked this pull request as ready for review June 11, 2024 06:16
@ManojLL ManojLL changed the title FLAG-69: evaluate flags for patient in parallel FLAG-69: Improve the performance of patient flag evaluation Jun 11, 2024
@wikumChamith
Copy link
Contributor

@ManojLL can you fix the merge conflicts?

@ManojLL ManojLL force-pushed the FLAG-69-generatpatientflags branch 2 times, most recently from 61aa5e9 to 1750407 Compare June 24, 2024 13:19
@ManojLL ManojLL force-pushed the FLAG-69-generatpatientflags branch 2 times, most recently from b9a9d6d to e268e23 Compare June 24, 2024 13:30
@ManojLL ManojLL force-pushed the FLAG-69-generatpatientflags branch from e268e23 to a1e4aa6 Compare June 24, 2024 13:37
// test each Flag in the cache against the specific Patient
for (Flag flag : filter.filter(flagCache)) {
for (final Flag flag : filter.filter(flagCache)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we switch to streams here?

Copy link
Contributor Author

@ManojLL ManojLL Jun 26, 2024

Choose a reason for hiding this comment

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

updated the code with forEach

executor = Executors.newSingleThreadExecutor();
}

executor = Executors.newSingleThreadExecutor();
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you remove the null check here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in this line , I initialized the executor as a thread pool. If the generateFlagForPatient method is called first, the executor is already initialized as thread pool, so then evaluateAllFlags uses a thread pool instead of a single thread. after removing the null check when evaluateAllFLag method calls it initialize the executor as a single thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants