Fraunhofer-AISEC / cpg

A library to extract Code Property Graphs from C/C++, Java, Go, Python, Ruby and every other language through LLVM-IR.
https://fraunhofer-aisec.github.io/cpg/
Apache License 2.0
246 stars 59 forks source link

Remove slow `toString` implementation #1525

Open oxisto opened 1 month ago

oxisto commented 1 month ago

This PR limits ourselves to a very limited implementation of toString. The old approach using a to-string-builder and including a lot of fields was actually costing some performance, for example in the (debug) output of the inference system.

I would argue that toString should only include the very basic things to quickly identify a node, which is in most cases its name and location and then sparsley adding additional information. In one particular case the execution time of the symbol resolver was reduced from 3000ms to 500ms.

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
78.6% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud