US 12,135,628 B2
Performance bug detection and code recommendation
Spandan Garg, Calgary (CA); Paul Sean Harrington, Seattle, WA (US); Chen Wu, Beiing (CN); and Roshanak Zilouchian Moghaddam, Kirkland, WA (US)
Assigned to MICROSOFT TECHNOLOGY LICENSING, LLC., Redmond, WA (US)
Filed by MICROSOFT TECHNOLOGY LICENSING, LLC., Redmond, WA (US)
Filed on Mar. 11, 2021, as Appl. No. 17/198,662.
Claims priority of provisional application 63/136,376, filed on Jan. 12, 2021.
Prior Publication US 2022/0222165 A1, Jul. 14, 2022
Int. Cl. G06F 11/34 (2006.01); G06F 8/41 (2018.01); G06F 8/71 (2018.01); G06F 11/36 (2006.01)
CPC G06F 11/3428 (2013.01) [G06F 8/427 (2013.01); G06F 8/443 (2013.01); G06F 8/71 (2013.01); G06F 11/3604 (2013.01)] 19 Claims
OG exemplary drawing
 
1. A system comprising:
one or more processors; and
a memory that stores one or more programs that are configured to be executed by the one or more processors, the one or more program comprising instructions to perform acts that:
obtain a query having a target source code snippet likely to have a performance bug;
transform the target source code snippet into a simplified parse tree, wherein the simplified parse tree comprises a plurality of nodes, wherein each node represents a keyword token or a non-keyword token;
extract, from the simplified parse tree, structural features and performance features from the target source code snippet, wherein a performance feature comprises at least one of a chain invocation feature, nested function call feature, repeat function call feature, definition or use feature or member access feature;
access a code recommendation table, wherein the code recommendation table comprises a plurality of performance-improved source code snippets, wherein the code recommendation table is indexed by a set of difference features for each performance-improved source code snippet, wherein the set of difference features comprises structural features and performance features of before-code version of a particular performance-improved source code snippet not seen in the particular performance-improved source code snippet;
search for performance-improved source code snippets in the code recommendation table having at least one performance feature matching a performance feature of the target source code snippet;
compute a score for each performance-improved source code snippet having at least one matching performance feature, wherein the score is based on the set of difference features of a performance-improved source code snippet;
identify one or more performance-improved source code snippets for the target source code snippet from the plurality of the performance-improved source code snippets having a score that exceeds a threshold, wherein the existence of the identified one or more performance-improved source code snippets indicate that the target source code snippet has a performance bug; and
outputting the identified one or more performance-improved source code snippets to remedy the performance bug, wherein the outputting comprises ranking the one or more performance-improved source code snippets in an order from highest score first.