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

Performance tests and improvements: LLVM and Type updates #775

Merged
merged 11 commits into from
Jun 15, 2022

Conversation

KuechA
Copy link
Contributor

@KuechA KuechA commented May 11, 2022

  • Test the performance of larger LLVM files
  • Improve performance when handling phi: Use SubgraphWalker less frequently
  • Improve performance of type updates: Use lists instead of sets

@sonarcloud
Copy link

sonarcloud bot commented Jun 15, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

88.8% 88.8% Coverage
22.6% 22.6% Duplication

@KuechA KuechA marked this pull request as ready for review June 15, 2022 08:09
@KuechA KuechA merged commit 1a350ab into master Jun 15, 2022
@KuechA KuechA deleted the llvm-cpg/performance branch June 15, 2022 12:09
return typeCache;
}

public synchronized void cacheType(HasType node, Type type) {
if (!isUnknown(type)) {
typeCache.computeIfAbsent(node, n -> new HashSet<>()).add(type);
List<Type> types = typeCache.computeIfAbsent(node, n -> new ArrayList<>());
if (!types.contains(type)) {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this essentially the same as a set does? Not sure this is really faster / better here.

@@ -131,7 +131,7 @@ public void setModifiers(List<String> modifiers) {
}

@Override
public void typeChanged(HasType src, Collection<HasType> root, Type oldType) {
public void typeChanged(HasType src, List<HasType> root, Type oldType) {
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to keep Collection in the function signature here?

@@ -83,7 +83,7 @@ public Type getPropagationType() {
}

@Override
public void setType(Type type, Collection<HasType> root) {
public void setType(Type type, List<HasType> root) {
Copy link
Member

Choose a reason for hiding this comment

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

Same here. Keep signature and only change the implememation?

@@ -165,12 +165,11 @@ public void typeChanged(HasType src, Collection<HasType> root, Type oldType) {
}

@Override
public void possibleSubTypesChanged(
HasType src, Collection<HasType> root, Set<Type> oldSubTypes) {
public void possibleSubTypesChanged(HasType src, List<HasType> root) {
Copy link
Member

Choose a reason for hiding this comment

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

Here as well I guess

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.

2 participants