opa icon indicating copy to clipboard operation
opa copied to clipboard

High evaluation time when referencing huge array

Open anderseknert opened this issue 2 years ago • 4 comments

Even when "unused", simply referencing a huge array will have a big impact on evaluation time.

package evaluator

access := bar {
	data.slow_bundle.index.feeds
	bar := "baz"
}

In the above case data.slow_bundle.index.feeds is a 10 MB JSON array containing some huge objects. I'd expect a simple reference to not have that kind of impact, as there's no evaluation needed in this case.

anderseknert avatar May 24 '23 09:05 anderseknert

Thanks guys! we really got to the point where this is an actual problem.

itayhac avatar Jun 01 '23 11:06 itayhac

@itayhac 👍 If you're able to share your actual policy where this is problematic, it could be a good test case for the fix.

anderseknert avatar Jun 01 '23 11:06 anderseknert

@anderseknert unfortunately the actual policy is a client's proprietary. but i will happily test the solution on the actual policy and update the result here.

itayhac avatar Jun 04 '23 07:06 itayhac

Sounds good. The reason I'm asking is that while the problem exposed by the example policy above is real, referencing an array without actually using it.. I guess there are cases where you'll want to know that it's defined, but most often the above example wouldn't make a lot of sense, I think.

anderseknert avatar Jun 05 '23 08:06 anderseknert