terraform/dag
Dennis Gursky 550de86135
Set Intersection #performance (#28183)
* Set Intersection #performance

Intersection is faster for sets of different sizes if one iterates over the shorter set and checks the presence of an element in a larger one. For an edge case consider `s` having 1M entries and `other` no entries at all. In this case original code will iterate over 1M entries in `s` not finding anything and then returning an empty result set. In the patched code the iteration won't happen at all and result is returned immediately.

This change is inspired by profiling a relatively large terraform configuration, where the time to validate was sped up 4x with this change.
2021-03-24 13:04:37 -04:00
..
dag.go Comment fixing 2020-10-18 13:00:09 -04:00
dag_test.go dag: staticcheck 2020-12-02 13:59:19 -05:00
dot.go dag: string DotOpts through to vertex 2017-01-08 11:59:18 -08:00
dot_test.go dag: string DotOpts through to vertex 2017-01-08 11:59:18 -08:00
edge.go dag: export more things 2015-02-19 12:08:07 -08:00
edge_test.go dag: Remove, RemoveEdge, DownEdges, UpEdges 2015-02-19 12:07:54 -08:00
graph.go dag: staticcheck 2020-12-02 13:59:19 -05:00
graph_test.go test Set.Copy, Graph.UpEdges, Graph.DownEdges 2020-06-11 09:53:09 -04:00
marshal.go dag: staticcheck 2020-12-02 13:59:19 -05:00
marshal_test.go quote dot node names 2020-06-15 13:28:53 -04:00
set.go Set Intersection #performance (#28183) 2021-03-24 13:04:37 -04:00
set_test.go Set Intersection #performance (#28183) 2021-03-24 13:04:37 -04:00
tarjan.go make UpEdges and DownEdges return a copy 2020-06-11 09:53:09 -04:00
tarjan_test.go dag: Remove, RemoveEdge, DownEdges, UpEdges 2015-02-19 12:07:54 -08:00
walk.go Grammar nit: "setup" as a verb should be spelled "set up" 2021-01-26 20:39:11 +01:00
walk_test.go dag: node visits return diagnostics rather than errors 2018-10-16 18:44:26 -07:00