IP Library Granted Patent US 11,520,579
Granted Patent B1
US 11,520,579 · App. 17/239,288 · Granted Dec 6, 2022

Automated asymptotic analysis

Inventors: Ashutosh Narkar (San Bruno, CA); Timothy L. Hinrichs (Los Altos, CA)
Assignee: STYRA, INC.
G06F8/77G06F8/443G06F8/75
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,520,579
App. No.
17/239,288
Granted
Dec 6, 2022
Kind
B1
Abstract

Some embodiments provide a method for identifying runtime complexity of a policy. The method receives, through a user interface (UI), a set of code defining a particular policy. For each variable in the particular policy, the method identifies a first occurrence of the variable in the particular policy to determine a number of values assigned to the variable. Variables determined to be assigned one value are separated from variables determined to be assigned more than one value. Based on the determinations for each variable, the method calculates a set of metrics that include at least time complexity, size complexity, and count complexity for the particular policy. The method then displays, through the UI, the calculated set of metrics along with a set of one or more suggestions for optimizing the particular policy based on the calculated set of metrics.

Claims (26)

1. A method for identifying runtime complexity of a policy, the method comprising:

receiving, through a user interface (UI), a set of code defining a particular policy;

for each variable in the particular policy, identifying a first occurrence of the variable in the particular policy to determine a number of values assigned to the variable, wherein variables determined to be assigned one value are separated from variables determined to be assigned more than one value;

based on the determinations for each variable, calculating a set of metrics comprising at least time complexity, size complexity, and count complexity for the particular policy, wherein time complexity comprises an expression over input representing a maximum number of elements from the input that are evaluated, size complexity comprises an expression over input representing a slice of data to which a variable evaluates, and count complexity comprises a number of values assigned to a variable within one of an array, a set, and an object; and

displaying, through the UI, the calculated set of metrics along with a set of one or more suggestions for optimizing the particular policy based on the calculated set of metrics.

2. The method of claim 1 , wherein variables that are determined to be assigned one value are further determined to be noniterative and variables that are determined to be assigned more than one value are further determined to be iterative.

3. The method of claim 2 further comprising for each iterative variable, identifying (i) a number of iterations for the variable and (ii) a set of values assigned to the variable.

4. The method of claim 2 , wherein noniterative variables are binned in a first data structure and iterative variables are binned in a second data structure.

5. The method of claim 4 , wherein at least one variable appears in at least two expressions of the particular policy.

6. The method of claim 1 , wherein only a first occurrence of the at least one variable is processed.

7. The method of claim 4 , wherein calculating the set of metrics for the particular policy further comprises using data from the first and second data structures to calculate the set of metrics.

8. The method of claim 1 further comprising receiving, through the UI, an optimized set of code defining the particular policy, wherein the optimized set of code comprises at least one implemented suggestion from the set of one or more suggestions.

9. The method of claim 1 , wherein each metric in the set of metrics is reported separately.

10. A non-transitory machine readable medium storing a program that when executed by a set of processing units, identifies runtime complexity of a policy, the program comprising sets of instructions for:

receiving, through a user interface (UI), a set of code defining a particular policy;

for each variable in the particular policy, identifying a first occurrence of the variable in the particular policy to determine a number of values assigned to the variable, wherein variables determined to be assigned one value are separated from variables determined to be assigned more than one value;

based on the determinations for each variable, calculating a set of metrics comprising at least time complexity, size complexity, and count complexity for the particular policy, wherein time complexity comprises an expression over input representing a maximum number of elements from the input that are evaluated, size complexity comprises an expression over input representing a slice of data to which a variable evaluates, and count complexity comprises a number of values assigned to a variable within one of an array, a set, and an object; and

displaying, through the UI, the calculated set of metrics along with a set of one or more suggestions for optimizing the particular policy based on the calculated set of metrics.

11. The non-transitory machine readable medium of claim 10 , wherein variables that are determined to be assigned one value are further determined to be noniterative and variables that are determined to be assigned more than one value are further determined to be iterative.

12. The non-transitory machine readable medium of claim 11 further comprising a set of instructions for identifying, for each iterative variable, (i) a number of iterations for the variable and (ii) a set of values assigned to the variable.

13. The non-transitory machine readable medium of claim 11 , wherein noniterative variables are binned in a first data structure and iterative variables are binned in a second data structure.

14. The non-transitory machine readable medium of claim 13 , wherein at least one variable appears in at least two expressions of the particular policy.

15. The non-transitory machine readable medium of claim 10 , wherein only a first occurrence of the at least one variable is processed.

16. The non-transitory machine readable medium of claim 13 , wherein the set of instructions for calculating the set of metrics for the particular policy further comprises a set of instructions for using data from the first and second data structures to calculate the set of metrics.

17. The non-transitory machine readable medium of claim 10 further comprising a set of instructions for receiving, through the UI, an optimized set of code defining the particular policy, wherein the optimized set of code comprises at least one implemented suggestion from the set of one or more suggestions.

18. The non-transitory machine readable medium of claim 10 , wherein each metric in the set of metrics is reported separately.

Assignments (3)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 5, 2025
From: STYRA, INC.
To: APPLE INC.
Reel/Frame 072818/0489 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 19, 2025
From: STYRA, INC.
To: APPLE INC.
Reel/Frame 072522/0568 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 23, 2021
From: NARKAR, ASHUTOSH; HINRICHS, TIMOTHY L.
To: STYRA, INC.
Reel/Frame 056027/0882 →
Continuity (1)
Provisional Application 63119560 · Nov 30, 2020
Cited By (4)
US 12,353,877 US 12,401,694 US 12,405,948 US 12,693,839