Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Performance improvements since upgrade to 2.16.6#781

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
knewbury01 merged 5 commits intomainfromlcartey/2-37-0-performance-improvements
Oct 24, 2024

Conversation

lcartey
Copy link
Collaborator

@lcarteylcartey commentedOct 24, 2024
edited by knewbury01
Loading

Description

Addresses some performance issues noted in the upgrade to 2.16.6:

  • Determination of compatible function types was slow across multiple queries. This has been addressed by standardizing on theCompatible.qll library, and ensuring all predicates are appropriately bound.
  • In some cases theisExcluded mechanism was causing bad join orders. These have been addressed on a case-by-base basis.
  • RULE-9-4 has been modified to perform a top-down, rather than bottom-up, detection of pairs of expressions initializing the same element in an array aggregate literal. This reduces the cases significantly.

The performance logs for 2.16.6 still note some increases, particularly in the calculation of standard library features such as the IR. I suggest we re-trigger performance analysis on this PR and see whether they replicate.

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql,.qll,.qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • rule number here
  • Queries have been modified for the following rules:
    • DCL40-C
    • RULE-5-1
    • RULE-8-3
    • RULE-8-4
    • MSC39-C

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No

🚨🚨🚨
Reviewer: Confirm that format ofshared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.

  • Confirmed

Reviewer: Confirm that either a change note is not required or the change note is required and has been added.

  • Confirmed

Query development review checklist

For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:

Author

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with thestyle guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Reviewer

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with thestyle guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Modify the `Compatible.qll` library to improve performance byrestricting to function declarations for the same function.Adopt the Compatible library in DCL40-C, which has also improveddetection of compatible types.
Hint optimizer to perform join of exclusions after determiningresults.
Refactored calculation to work top down, instead of bottom up,which ensures we are always comparing elements from within thesame initializer.
@lcarteylcartey added this to the2.37.0 milestoneOct 24, 2024
@lcartey
Copy link
CollaboratorAuthor

/test-performance

@github-actionsGitHub Actions
Copy link

🏁 Beep Boop! Performance testing for this PR has been initiated. Please check back later for results. Note that the query package generation step must complete before testing will start so it might be a minute.

💡 If you do not hear back from me please check my status!I will report even if I fail!

@codeql-coding-standards-automationCodeQL Coding Standards Automation

🏁 Beep Boop! Performance testing complete! See below for performance of the last 3 runs vs your PR. Times are based on predicate performance. You canfind full graphs and stats in the PR that was created for this test in the release engineering repo.

Release                            : v2.35.0Platform                           : x86-linuxLanguage                           : cTotal_Serialized_Execution_Time_Ms : 4397696Mean_Predicate_Execution_Time_Ms   : 114.38333289983612Median_Predicate_Execution_Time_Ms : 1.0Standard_Deviation_Ms              : 2125.1712718811877Total_Serialized_Execution_Time_s  : 4397.696Mean_Query_Execution_Time_s        : 0.1143833328998361Median_Predicate_Execution_Time_s  : 0.001Percentile95_Ms                    : 274.0Number_of_Predicates               : 38447Release                            : v2.35.0Platform                           : x86-linuxLanguage                           : cppTotal_Serialized_Execution_Time_Ms : 5283229Mean_Predicate_Execution_Time_Ms   : 123.28150740870376Median_Predicate_Execution_Time_Ms : 2.0Standard_Deviation_Ms              : 1186.327155939601Total_Serialized_Execution_Time_s  : 5283.229Mean_Query_Execution_Time_s        : 0.1232815074087037Median_Predicate_Execution_Time_s  : 0.002Percentile95_Ms                    : 290.0Number_of_Predicates               : 42855Release                            : v2.35.0Platform                           : x86-windowsLanguage                           : cTotal_Serialized_Execution_Time_Ms : 6332025Mean_Predicate_Execution_Time_Ms   : 164.07185240846786Median_Predicate_Execution_Time_Ms : 3.0Standard_Deviation_Ms              : 2309.541856304362Total_Serialized_Execution_Time_s  : 6332.025Mean_Query_Execution_Time_s        : 0.1640718524084678Median_Predicate_Execution_Time_s  : 0.003Percentile95_Ms                    : 489.0Number_of_Predicates               : 38593Release                            : v2.35.0Platform                           : x86-windowsLanguage                           : cppTotal_Serialized_Execution_Time_Ms : 7299920Mean_Predicate_Execution_Time_Ms   : 168.56601856555673Median_Predicate_Execution_Time_Ms : 4.0Standard_Deviation_Ms              : 1341.6973819978125Total_Serialized_Execution_Time_s  : 7299.92Mean_Query_Execution_Time_s        : 0.1685660185655567Median_Predicate_Execution_Time_s  : 0.004Percentile95_Ms                    : 472.75Number_of_Predicates               : 43306Release                            : v2.36.0Platform                           : x86-windowsLanguage                           : cppTotal_Serialized_Execution_Time_Ms : 4565606Mean_Predicate_Execution_Time_Ms   : 100.34739988570928Median_Predicate_Execution_Time_Ms : 2.0Standard_Deviation_Ms              : 544.7653788145617Total_Serialized_Execution_Time_s  : 4565.606Mean_Query_Execution_Time_s        : 0.1003473998857092Median_Predicate_Execution_Time_s  : 0.002Percentile95_Ms                    : 347.0Number_of_Predicates               : 45498Release                            : v2.36.0Platform                           : x86-windowsLanguage                           : cTotal_Serialized_Execution_Time_Ms : 3957536Mean_Predicate_Execution_Time_Ms   : 94.59868531134218Median_Predicate_Execution_Time_Ms : 2.0Standard_Deviation_Ms              : 558.0527014506762Total_Serialized_Execution_Time_s  : 3957.536Mean_Query_Execution_Time_s        : 0.0945986853113421Median_Predicate_Execution_Time_s  : 0.002Percentile95_Ms                    : 344.0Number_of_Predicates               : 41835Release                            : v2.36.0Platform                           : x86-linuxLanguage                           : cppTotal_Serialized_Execution_Time_Ms : 4154858Mean_Predicate_Execution_Time_Ms   : 91.33764206731296Median_Predicate_Execution_Time_Ms : 2.0Standard_Deviation_Ms              : 630.2504007516633Total_Serialized_Execution_Time_s  : 4154.858Mean_Query_Execution_Time_s        : 0.0913376420673129Median_Predicate_Execution_Time_s  : 0.002Percentile95_Ms                    : 245.0Number_of_Predicates               : 45489Release                            : v2.36.0Platform                           : x86-linuxLanguage                           : cTotal_Serialized_Execution_Time_Ms : 2707846Mean_Predicate_Execution_Time_Ms   : 65.13629365919368Median_Predicate_Execution_Time_Ms : 1.0Standard_Deviation_Ms              : 466.2819432351967Total_Serialized_Execution_Time_s  : 2707.846Mean_Query_Execution_Time_s        : 0.0651362936591936Median_Predicate_Execution_Time_s  : 0.001Percentile95_Ms                    : 197.0Number_of_Predicates               : 41572Release                            : 781Platform                           : x86-linuxLanguage                           : cppTotal_Serialized_Execution_Time_Ms : 3731220Mean_Predicate_Execution_Time_Ms   : 82.6588391670359Median_Predicate_Execution_Time_Ms : 2.0Standard_Deviation_Ms              : 648.4685746979167Total_Serialized_Execution_Time_s  : 3731.22Mean_Query_Execution_Time_s        : 0.0826588391670359Median_Predicate_Execution_Time_s  : 0.002Percentile95_Ms                    : 217.0Number_of_Predicates               : 45140Release                            : 781Platform                           : x86-linuxLanguage                           : cTotal_Serialized_Execution_Time_Ms : 2600100Mean_Predicate_Execution_Time_Ms   : 62.28530362917715Median_Predicate_Execution_Time_Ms : 1.0Standard_Deviation_Ms              : 508.9199149475738Total_Serialized_Execution_Time_s  : 2600.1Mean_Query_Execution_Time_s        : 0.0622853036291771Median_Predicate_Execution_Time_s  : 0.001Percentile95_Ms                    : 189.0Number_of_Predicates               : 41745

🏁 Below are the slowest predicates for the last 2 releases vs this PR.

Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : HardwareOrProtocolInterface::HardwareOrProtocolInterfaceClass#class#7f026171Execution_Time_Ms : 25745Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : ___@element#b_Deviations::DeviationRecord.getACodeIdentifierComment/0#dispred#10d8760b_10#join_rhs_D__#sharedExecution_Time_Ms : 31533Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : CheckedException::CheckedException#b0aa5ec8Execution_Time_Ms : 32446Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : CharacterOutsideTheLanguageStandardBasicSourceCharacterSetUsedInTheSourceCode::getUniversalCharacterName/1#36dbaa42Execution_Time_Ms : 33747Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-windowsLanguage          : cSuite             : misra-defaultPredicate         : _Expr::Expr.getValueText/0#dispred#a49585d4#bf#antijoin_rhsExecution_Time_Ms : 17061Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-windowsLanguage          : cSuite             : misra-defaultPredicate         : OutOfBounds::OOB::libraryFunctionNameParamTableSimpleString/5#6de8614f#cpe#1236Execution_Time_Ms : 30801Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-windowsLanguage          : cSuite             : misra-defaultPredicate         : OutOfBounds::OOB::libraryFunctionNameParamTable/5#79217c12Execution_Time_Ms : 22507Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-windowsLanguage          : cppSuite             : autosar-defaultPredicate         : CheckedException::CheckedException#b0aa5ec8Execution_Time_Ms : 16245Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-windowsLanguage          : cppSuite             : autosar-defaultPredicate         : SSAConstruction::DefUse::defUseRank/4#b00da839Execution_Time_Ms : 14286Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-windowsLanguage          : cppSuite             : autosar-defaultPredicate         : CheckedException::CheckedException#b0aa5ec8Execution_Time_Ms : 21772Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-windowsLanguage          : cSuite             : misra-defaultPredicate         : QualifiedName::getUserTypeNameWithoutArgs/1#8cfc98e9Execution_Time_Ms : 24620Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-windowsLanguage          : cSuite             : misra-defaultPredicate         : RepeatedInitializationOfAggregateObjectElement::hasMultipleInitializerExprsForSameIndexInternal/4#a4626bc8_3012#join_rhsExecution_Time_Ms : 15124Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-windowsLanguage          : cppSuite             : autosar-defaultPredicate         : Dependency::dependsOnTransitive/2#cbda84a0Execution_Time_Ms : 18059Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : QualifiedName::getUserTypeNameWithoutArgs/1#8cfc98e9Execution_Time_Ms : 32674Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-windowsLanguage          : cppSuite             : autosar-defaultPredicate         : ___@element#b_Deviations::DeviationRecord.getACodeIdentifierComment/0#dispred#10d8760b_10#join_rhs_D__#sharedExecution_Time_Ms : 16357Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : QualifiedName::getUserTypeNameWithoutArgs/1#8cfc98e9Execution_Time_Ms : 22815Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : OutOfBounds::OOB::libraryFunctionNameParamTableSimpleString/5#6de8614f#cpe#1236Execution_Time_Ms : 35361Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-linuxLanguage          : cSuite             : cert-defaultPredicate         : OutOfBounds::OOB::libraryFunctionNameParamTable/5#79217c12Execution_Time_Ms : 15487Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-linuxLanguage          : cSuite             : cert-defaultPredicate         : OutOfBounds::OOB::libraryFunctionNameParamTable/5#79217c12Execution_Time_Ms : 21324Release           : v2.36.0Run               : 2024-10-18_14-06-09Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : _Expr::Expr.getValueText/0#dispred#a49585d4#bf#antijoin_rhsExecution_Time_Ms : 18015Release           : 781Run               : 2024-10-24_11-19-51Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : CharacterOutsideTheLanguageStandardBasicSourceCharacterSetUsedInTheSourceCode::getUniversalCharacterName/1#36dbaa42Execution_Time_Ms : 31295Release           : 781Run               : 2024-10-24_11-19-51Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : CheckedException::CheckedException#b0aa5ec8Execution_Time_Ms : 30865Release           : 781Run               : 2024-10-24_11-19-51Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : QualifiedName::getUserTypeNameWithoutArgs/1#8cfc98e9Execution_Time_Ms : 30261Release           : 781Run               : 2024-10-24_11-19-51Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : HardwareOrProtocolInterface::HardwareOrProtocolInterfaceClass#class#7f026171Execution_Time_Ms : 27121Release           : 781Run               : 2024-10-24_11-19-51Platform          : x86-linuxLanguage          : cppSuite             : autosar-defaultPredicate         : ___@element#b_Deviations::DeviationRecord.getACodeIdentifierComment/0#dispred#10d8760b_10#join_rhs_D__#sharedExecution_Time_Ms : 23658Release           : 781Run               : 2024-10-24_11-19-51Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : _Macro::Macro.getName/0#dispred#e28b3699_Preprocessor::PreprocessorBranchDirective#bcd2bde4#b_Prepro__#antijoin_rhsExecution_Time_Ms : 46160Release           : 781Run               : 2024-10-24_11-19-51Platform          : x86-linuxLanguage          : cSuite             : cert-defaultPredicate         : OutOfBounds::OOB::libraryFunctionNameParamTable/5#79217c12Execution_Time_Ms : 21710Release           : 781Run               : 2024-10-24_11-19-51Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : QualifiedName::getUserTypeNameWithoutArgs/1#8cfc98e9Execution_Time_Ms : 21892Release           : 781Run               : 2024-10-24_11-19-51Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : OutOfBounds::OOB::libraryFunctionNameParamTable/5#79217c12Execution_Time_Ms : 20440Release           : 781Run               : 2024-10-24_11-19-51Platform          : x86-linuxLanguage          : cSuite             : misra-defaultPredicate         : OutOfBounds::OOB::libraryFunctionNameParamTableSimpleString/5#6de8614f#cpe#1236Execution_Time_Ms : 34747

@lcartey
Copy link
CollaboratorAuthor

Publishing a re-formatted table of total serialized time (in seconds) for easier review:

Versionx86-linux-cx86-linux-cpp
v2.35.05283.2295283.229
v2.36.02707.8464154.858
#7812600.13731.22

With these changes performance is slightly improved for C (4% decrease) and a more significant improvement for C++ (10% decrease) vs. the last release (and a significant performance improvement on both since v2.35.0).

@knewbury01 this should address the slow performance we saw in the 2.37.0 release candidate.

knewbury01 reacted with thumbs up emoji

Copy link
Contributor

@knewbury01knewbury01 left a comment

Choose a reason for hiding this comment

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

@lcartey only one small accidental commented out code to remove

otherwise this all looks good to me

Copy link
Contributor

@knewbury01knewbury01 left a comment

Choose a reason for hiding this comment

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

lgtm!

@knewbury01knewbury01 added this pull request to themerge queueOct 24, 2024
Merged via the queue intomain with commit42c2b88Oct 24, 2024
24 checks passed
@knewbury01knewbury01 deleted the lcartey/2-37-0-performance-improvements branchOctober 24, 2024 17:28
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@knewbury01knewbury01knewbury01 approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
2.37.0
Development

Successfully merging this pull request may close these issues.

2 participants
@lcartey@knewbury01

[8]ページ先頭

©2009-2025 Movatter.jp