Comments (3)
Good find!
Looking at the output from the compiler (using opa-explorer), the nested iteration is left intact, while the some .. in
loops are rewritten to something like this:
all_operations contains operation if {
allowed_operation := role_allowed_operations[_]
operation := allowed_operation[_]
}
Which seems to have the same negative impact compared to nesting the loop. I'd guess it's got something to do with all the intermediate values having to be realized on the "Rego side", but someone else (@johanfylling?) likely knows better :) If that is the case, it would be nice if the compiler could identify sequences of some .. in
iteration and rewrite them to a single nested iteration where possible.
(btw, I think "more performant" should be "less performant" in the description 🙂)
from opa.
I can confirm that evaluation of the "short-form" enumeration role_allowed_operations[_][operation]
is slightly different, and it' wouldn't surprise me if this has a performance impact.
As @anderseknert suggests, I think it should be possible to detect this at compile-time (at least trivial cases), and optimize accordingly.
from opa.
This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. Although currently inactive, the issue could still be considered and actively worked on in the future. More details about the use-case this issue attempts to address, the value provided by completing it or possible solutions to resolve it would help to prioritize the issue.
from opa.
Related Issues (20)
- Support AWS_CONTAINER_CREDENTIALS_FULL_URI environment variable
- fmt: allow to specify max line length or somehow ignore user given line breaks HOT 2
- "rego_type_error: multiple default rules" should include all locations where found
- Handle incorrect user input in OPA envoy plugin HOT 5
- Chunked HTTP requests broken in 0.67.0 HOT 2
- W3C tracing does not work as expected HOT 3
- Performance Degrade since v0.67.0 on glob.match with lots of patterns HOT 11
- Performance issue when using optimize level 2 HOT 13
- Not able to access rego policies from other drive in windows HOT 4
- Improve `concat` to accept numeric values HOT 1
- OPA support for persisted bundles with names using special characters in Windows HOT 7
- Reuse service from configuration in http.send HOT 3
- builtins: Error JWT but payload is not JSON when using io.jwt.encode_sign with set as payload value HOT 8
- Lost in iteration: values lost when iterating ref head rules mixing static and dynamic paths HOT 1
- Add metadata annotation for reusable schema references HOT 1
- Ref-head partial object doc rules can cause nil pointer dereference in compiler
- Extend METADATA scopes to include "file" scope HOT 1
- Improvement of OpenSSF Scorecard Score HOT 2
- OPA does not save bundle files to disk HOT 4
- Add support for OpenTelemetry resource attributes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opa.