IP Library Granted Patent US 12,353,877
Granted Patent B1
US 12,353,877 · App. 18/075,301 · Granted Jul 8, 2025

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 12,353,877
App. No.
18/075,301
Granted
Jul 8, 2025
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 (54)

1. A method for modifying code used to define a policy based on runtime complexity of the code defining the policy, the method comprising:

receiving, through a user interface (UI), a first set of code that a user authors to define a particular policy comprising a plurality of rules, each rule comprising a set of variables;

for each rule in the particular policy, analyzing a number of occurrences of each variable in the set of variables of the rule;

based at least in part on the analysis of the number of occurrences of each variable in the set of variables for each rule in the particular policy, calculating a set of complexity metrics for the particular policy that express complexity of the particular policy;

based on the calculated set of complexity metrics, identifying a set of one or more suggestions for defining the particular policy in a more optimized way than the first set of code;

displaying, through the UI, (i) the identified set of one or more suggestions and (ii) a selectable control for selecting one or more of the set of suggestions;

receiving a selection of at least one identified suggestion; and

after receiving the selection, replacing the first set of code with a second set of code that defines the particular policy in a more optimized way than the first set of code.

2. The method of claim 1 , wherein calculating the set of complexity metrics comprises calculating, for each rule in the particular policy, at least two of time complexity, size complexity, and count complexity.

3. The method of claim 1 , wherein for a particular rule, analyzing the number of occurrences of each variable of the particular rule comprises identifying, for each variable, a first occurrence of the variable in the particular rule 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.

4. The method of claim 3 , 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.

5. The method of claim 4 , wherein analyzing the number of occurrences of each variable of the particular rule further comprises, for each iterative variable, identifying (i) a number of iterations for the variable and (ii) a set of values assigned to the variable.

6. The method of claim 3 , wherein analyzing the number of occurrences of each variable in the particular rule further comprises binning variables that are assigned only one value in a first data structure and binning variables that are assigned more than one value in a second data structure.

7. The method of claim 1 , wherein:

at least one variable appears in at least two expressions of the particular policy; and

only a first occurrence of the at least one variable is processed during the analysis of the number of occurrences of each variable in the set of variables of the rule.

8. The method of claim 1 , wherein:

identifying the set of suggestions comprises generating one or more different sets of code that represent one or more optimized versions of the first set of code that defines the particular policy, wherein the different sets of code comprise the second set of code; and

displaying the set of suggestions comprises displaying, through the UI, description of the one or more suggestions for defining the particular policy.

9. The method of claim 1 further comprising displaying, through the UI, the selectable control for selecting the second set of code that defines the particular policy.

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 first set of code that a user authors to define a particular policy comprising a plurality of rules, each rule comprising a set of variables; and

for each rule in the particular policy, analyzing a number of occurrences of each variable in the set of variables of the rule;

based at least in part on the analysis of the number of occurrences of each variable in the set of variables for each rule in the particular policy, calculating a set of complexity metrics for the particular policy that express complexity of the particular policy; and

based on the calculated set of complexity metrics, identifying a set of one or more suggestions for defining the particular policy in a more optimized way than the first set of code;

displaying, through the UI, the identified set of one or more suggestions for defining the particular policy in a more optimized way than the first set of code; and

after receiving a selection of one of the identified suggestions, replacing the first set of code with a second set of code that defines the particular policy in a more optimized way than the first set of code.

11. The non-transitory machine readable medium of claim 10 , wherein the set of instructions for analyzing the number of occurrences of each variable in the set of variables for a particular rule comprises a set of instructions for identifying, for each variable, a first occurrence of the variable in the particular rule 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.

12. The non-transitory machine readable medium of claim 11 , 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;

and the set of instructions for analyzing the number of occurrences of each variable of the particular rule further comprises 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 12 , wherein the set of instructions for analyzing the number of occurrences of each variable in the particular rule further comprises a set of instructions for binning variables that are assigned only one value in a first data structure and binning variables that are assigned more than one value in a second data structure.

14. The non-transitory machine readable medium of claim 10 , wherein:

at least one variable appears in at least two expressions of the particular policy; and

only a first occurrence of the at least one variable is processed during the analysis of the number of occurrences of each variable in the set of variables of the rule.

15. The non-transitory machine readable medium of claim 10 , wherein:

the set of instructions for identifying the set of suggestsions comprises a set of instructions for generating one or more different sets of code that represent one or more optimized versions of the first set of code that defines the particular policy, wherein the different sets of code comprise the second set of code; and

the set of instructions for displaying comprises a set of instructions for displaying, through the UI, description of the one or more suggestions for defining the particular policy.

16. The method of claim 1 , wherein the set of complexity metrics comprises a runtime complexity metric that expresses a complexity of executing the particular policy at runtime.

17. The non-transitory machine readable medium of claim 10 , wherein the set of complexity metrics comprises a runtime complexity metric that expresses a complexity of executing the particular policy at runtime.

18. The method of claim 1 , wherein calculating the set of complexity metrics for the particular policy comprises, for a particular complexity metric:

for each rule in the particular policy, calculating the particular complexity metric based at least in part on the number of occurrences of each variable in the set of variables for the rule; and

computing the particular complexity metric for the particular policy as a summation of the particular complexity metric calculations for each rule in the particular policy.

19. The method of claim 1 , wherein:

the set of complexity metrics comprises at least two different complexity metrics; and

each of the complexity metrics calculated for the particular policy is a summation of corresponding complexity metrics calculated for each rule of the particular policy.

20. The method of claim 19 , wherein:

calculating a first complexity metric for a particular rule comprises using a calculated second complexity metric for the particular rule; and

the second complexity metric and a third complexity metric for the particular rule are calculated independendently of the other complexity metrics.

21. The method of claim 19 , wherein, for a particular rule, a first complexity metric is a constant value and a second complexity metric is a function of a value assigned to at least one variable of the rule.

22. The method of claim 1 , wherein the method is performed by an interactive online tool, the method further comprising sharing the particular policy defined by the second set of code.

23. The method of claim 1 , wherein:

a particular complexity metric indicates that the first set of code has a complexity that is linear based on an amount of data in an array evaluated by the policy; and

at least one identified suggestion for defining the particular policy improves the set of code to have a complexity that is constant irrespective of the amount of data.

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 Aug 13, 2025
From: HINRICHS, TIMOTHY L.; NARKAR, ASHUTOSH
To: STYRA, INC.
Reel/Frame 072012/0666 →
Continuity (2)
Continuation 17239288 · Apr 23, 2021
Provisional Application 63119560 · Nov 30, 2020
References Cited (105)
US 5974549A · Golan · 1999 [cited by applicant]
US 6023583A · Honda · 2000 [cited by applicant]
US 6985953B1 · Sandhu et al. · 2006 [cited by applicant]
US 7043659B1 · Klein · 2006 [cited by examiner]
US 7124192B2 · High, Jr. et al. · 2006 [cited by applicant]
US 7752661B2 · Hemsath et al. · 2010 [cited by applicant]
US 8266694B1 · Roy · 2012 [cited by applicant]
US 8613070B1 · Borzycki et al. · 2013 [cited by applicant]
US 8683560B1 · Brooker et al. · 2014 [cited by applicant]
US 8782744B1 · Fuller et al. · 2014 [cited by applicant]
US 8789138B2 · Reierson et al. · 2014 [cited by applicant]
US 9098292B1 · Zhang · 2015 [cited by examiner]
US 9397990B1 · Taly et al. · 2016 [cited by applicant]
US 9530020B2 · Brandwine et al. · 2016 [cited by applicant]
US 9578004B2 · Greenspan et al. · 2017 [cited by applicant]
US 9648040B1 · Morkel et al. · 2017 [cited by applicant]
US 10122757B1 · Kruse et al. · 2018 [cited by applicant]
US 10127393B2 · Ferraiolo et al. · 2018 [cited by applicant]
US 10257184B1 · Mehta et al. · 2019 [cited by applicant]
US 10353726B2 · Duan · 2019 [cited by applicant]
US 10454975B1 · Mehr · 2019 [cited by applicant]
US 10469314B2 · Ennis, Jr. et al. · 2019 [cited by applicant]
US 10592302B1 · Hinrichs et al. · 2020 [cited by applicant]
US 10592683B1 · Lim · 2020 [cited by examiner]
US 10715514B1 · Threlkeld · 2020 [cited by applicant]
US 10719373B1 · Koponen et al. · 2020 [cited by applicant]
US 10789220B2 · Mayer et al. · 2020 [cited by applicant]
US 10984133B1 · Hinrichs et al. · 2021 [cited by applicant]
US 10986131B1 · Kruse · 2021 [cited by examiner]
US 10990702B1 · Hinrichs et al. · 2021 [cited by applicant]
US 11023292B1 · Hinrichs et al. · 2021 [cited by applicant]
US 11080410B1 · Sandall et al. · 2021 [cited by applicant]
US 11108827B2 · Beckman et al. · 2021 [cited by applicant]
US 11108828B1 · Curtis et al. · 2021 [cited by applicant]
US 11170099B1 · Sandall · 2021 [cited by examiner]
US 11245728B1 · Curtis et al. · 2022 [cited by applicant]
US 11258824B1 · Hinrichs et al. · 2022 [cited by applicant]
US 11327815B1 · Koponen et al. · 2022 [cited by applicant]
US 11425126B1 · Horal et al. · 2022 [cited by applicant]
US 11470121B1 · Curtis et al. · 2022 [cited by applicant]
US 11477238B1 · Curtis et al. · 2022 [cited by applicant]
US 11477239B1 · Curtis et al. · 2022 [cited by applicant]
US 11494518B1 · Curtis et al. · 2022 [cited by applicant]
US 11496517B1 · Hinrichs et al. · 2022 [cited by applicant]
US 11502992B1 · Koponen et al. · 2022 [cited by applicant]
US 11509658B1 · Kulkarni · 2022 [cited by applicant]
US 11513778B1 · Graves et al. · 2022 [cited by applicant]
US 11520579B1 · Narkar et al. · 2022 [cited by applicant]
US 11847241B1 · Cahill et al. · 2023 [cited by applicant]
US 20050114674A1 · Carley · 2005 [cited by applicant]
US 20070156670A1 · Lim · 2007 [cited by applicant]
US 20080127152A1 · Bera · 2008 [cited by applicant]
US 20090063665A1 · Bagepalli et al. · 2009 [cited by applicant]
US 20090077618A1 · Pearce et al. · 2009 [cited by applicant]
US 20100281462A1 · Festa · 2010 [cited by examiner]
US 20100333079A1 · Sverdlov et al. · 2010 [cited by applicant]
US 20110113484A1 · Zeuthen · 2011 [cited by applicant]
US 20120030354A1 · Razzaq et al. · 2012 [cited by applicant]
US 20120066756A1 · Vysogorets et al. · 2012 [cited by applicant]
US 20120117608A1 · Metke · 2012 [cited by examiner]
US 20120144295A1 · Clark · 2012 [cited by examiner]
US 20120221810A1 · Shah et al. · 2012 [cited by applicant]
US 20120311672A1 · Connor et al. · 2012 [cited by applicant]
US 20120331539A1 · Matsugashita · 2012 [cited by applicant]
US 20130226970A1 · Weber et al. · 2013 [cited by applicant]
US 20140032691A1 · Barton et al. · 2014 [cited by applicant]
US 20140032759A1 · Barton et al. · 2014 [cited by applicant]
US 20140033267A1 · Aciicmez · 2014 [cited by applicant]
US 20140237594A1 · Thakadu et al. · 2014 [cited by applicant]
US 20150089575A1 · Vepa et al. · 2015 [cited by applicant]
US 20150213449A1 · Morrison et al. · 2015 [cited by applicant]
US 20150295808A1 · O'Malley et al. · 2015 [cited by applicant]
US 20160034900A1 · Nelsen et al. · 2016 [cited by applicant]
US 20160057107A1 · Call et al. · 2016 [cited by applicant]
US 20170024428A1 · Patiejunas et al. · 2017 [cited by applicant]
US 20170161120A1 · Sasaki et al. · 2017 [cited by applicant]
US 20170220370A1 · Klompje et al. · 2017 [cited by applicant]
US 20170237729A1 · Uppalapati · 2017 [cited by applicant]
US 20170302655A1 · Sondhi et al. · 2017 [cited by applicant]
US 20170346807A1 · Blasi · 2017 [cited by applicant]
US 20170364702A1 · Goldfarb · 2017 [cited by examiner]
US 20180067790A1 · Chheda et al. · 2018 [cited by applicant]
US 20180082053A1 · Brown et al. · 2018 [cited by applicant]
US 20180109538A1 · Kumar et al. · 2018 [cited by applicant]
US 20180309746A1 · Blasi · 2018 [cited by applicant]
US 20190007418A1 · Cook et al. · 2019 [cited by applicant]
US 20190007443A1 · Cook et al. · 2019 [cited by applicant]
US 20190190959A1 · Yuan · 2019 [cited by examiner]
US 20190230130A1 · Beckman et al. · 2019 [cited by applicant]
US 20190236975A1 · Chong · 2019 [cited by examiner]
US 20190245862A1 · Kruse et al. · 2019 [cited by applicant]
US 20190386973A1 · Patwardhan et al. · 2019 [cited by applicant]
US 20200007580A1 · Liderman et al. · 2020 [cited by applicant]
US 20200234346A1 · Venkateswaran · 2020 [cited by examiner]
US 20200241921A1 · Calmon et al. · 2020 [cited by applicant]
US 20210029029A1 · Mehmedagic et al. · 2021 [cited by applicant]
US 20210240550A1 · Hinrichs et al. · 2021 [cited by applicant]
US 20210248017A1 · Hinrichs et al. · 2021 [cited by applicant]
US 20210365571A1 · Sandall et al. · 2021 [cited by applicant]
US 20220269549A1 · Koponen et al. · 2022 [cited by applicant]
Author Unknown, “API Best Practices Managing the API Lifecycle: Design, Delivery, and Everything in Between,” Dec. 2016, 37 pages, Apigee, retrieved from https://pages.apigee.com/rs/351-WXY-166/images/API-Best-Practices… [cited by applicant]
Costa, Jeff, “Improve API Performance with Caching,” API Gateway, May 3, 2018, 18 pages, Akamai Developer, retrieved from https://developer.akamai.com/blog/2018/05/31/improve-api-performance-caching. [cited by applicant]
Non-Published commonly Owned U.S. Appl. No. 16/050,119, filed Jul. 31, 2018, 55 pages, Styra, Inc. [cited by applicant]
Non-Published commonly Owned U.S. Appl. No. 16/050,143, filed Jul. 31, 2018, 56 pages, Styra, Inc. [cited by applicant]
Win, Thu Yein, et al., “Virtualization Security Combining Mandatory Access Control and Virtual Machine Introspection,” 2014 IEEE/ACM 7th International Conference on Utility and Cloud Computing, Dec. 8-11, 2014, 6 pages,… [cited by applicant]