// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.text; import java.util.HashMap; import java.util.Map; /** * A benchmark of map parsing. * Expected time on Jon's mac: 200 microseconds per 1k size map. * * @author bratseth */ public class MapParserMicroBenchmark { private static String generateValues(int size) { StringBuilder b = new StringBuilder("{"); for (int i=0; i map = new HashMap<>(); for (int i=0; i rankingExpressionParserParse(String values, Map map) { return new DoubleMapParser().parse(values,map); } public static void main(String[] args) { new MapParserMicroBenchmark().benchmark(100*1000,1000); } private static class DoubleMapParser extends MapParser { @Override protected Double parseValue(String s) { return Double.parseDouble(s); } } }