There might be other things we can optimize though - e.g. using mutable collections? We might need to make DataFlowAnalyzer aware of Sets in that case though - i.e. its T will be the elemnt, rather than the set type.
Surprisingly, this makes it 3x slower!
There might be other things we can optimize though - e.g. using mutable collections? We might need to make DataFlowAnalyzer aware of Sets in that case though - i.e. its T will be the elemnt, rather than the set type.
I've tried the work list approach again and it seems much faster (did I make a mistake before?) but it'd be good to confirm it with some benchmarking.
I also wonder if we can improve the performance by changing the order we add nodes to the work list in initially (before we enter the loop).
I've tried the work list approach again and it seems much faster (did I make a mistake before?) but it'd be good to confirm it with some benchmarking.
I also wonder if we can improve the performance by changing the order we add nodes to the work list in initially (before we enter the loop).
See https://en.wikipedia.org/wiki/Data-flow_analysis#The_work_list_approach
Surprisingly, this makes it 3x slower!
There might be other things we can optimize though - e.g. using mutable collections? We might need to make DataFlowAnalyzer aware of Sets in that case though - i.e. its T will be the elemnt, rather than the set type.
I think we might also want to consider the iteration order. (This would be easier to do if we switched to jgrapht.)
I've tried the work list approach again and it seems much faster (did I make a mistake before?) but it'd be good to confirm it with some benchmarking.
I also wonder if we can improve the performance by changing the order we add nodes to the work list in initially (before we enter the loop).
The work list approach is definitely faster - by about 6x!