A General Methodology to Optimize and Benchmark Edge Devices