Optimal and Perfectly Parallel Algorithms for On-demand Data-Flow Analysis