content: package com.alibaba.json.test.benchmark;
  
  import com.alibaba.fastjson.JSON;
  import com.alibaba.fastjson.JSONPath;
  import com.alibaba.fastjson.parser.Feature;
  
  public class JSONPathBenchmarkTest {
  
      public static void main(String[] args) throws Exception {
          for (int i = 0; i < 5; ++i) {
               f0(); // 390 353
          }
          for (int i = 0; i < 5; ++i) {
  //            f1();
          }
      }
  
      public static void f0() throws Exception {
          long start = System.currentTimeMillis();
          for (int i = 0; i < 1000 * 1000; ++i) {
              Object val = JSONPath.extract(json2, "$.expensive");
              if (((Integer) val).intValue() != 10) {
                  throw new Exception();
              }
          }
          long millis = System.currentTimeMillis() - start;
          System.out.println("extract millis : " + millis);
      }
  
      public static void f1() throws Exception {
          long start = System.currentTimeMillis();
          for (int i = 0; i < 1000 * 1000; ++i) {
              Object val = JSONPath.read(json2, "$.expensive");
              if (((Integer) val).intValue() != 10) {
                  throw new Exception();
              }
          }
          long millis = System.currentTimeMillis() - start;
          System.out.println("eval millis : " + millis);
      }
  
      public static final String json = "{\n" +
              "    \"store\": {\n" +
              "        \"book\": [\n" +
              "            {\n" +
              "                \"category\": \"reference\",\n" +
              "                \"author\": \"Nigel Rees\",\n" +
              "                \"title\": \"Sayings of the Century\",\n" +
              "                \"price\": 8.95\n" +
              "            },\n" +
              "            {\n" +
              "                \"category\": \"fiction\",\n" +
              "                \"author\": \"Evelyn Waugh\",\n" +
              "                \"title\": \"Sword of Honour\",\n" +
              "                \"price\": 12.99\n" +
              "            },\n" +
              "            {\n" +
              "                \"category\": \"fiction\",\n" +
              "                \"author\": \"Herman Melville\",\n" +
              "                \"title\": \"Moby Dick\",\n" +
              "                \"isbn\": \"0-553-21311-3\",\n" +
              "                \"price\": 8.99\n" +
              "            },\n" +
              "            {\n" +
              "                \"category\": \"fiction\",\n" +
              "                \"author\": \"J. R. R. Tolkien\",\n" +
              "                \"title\": \"The Lord of the Rings\",\n" +
              "                \"isbn\": \"0-395-19395-8\",\n" +
              "                \"price\": 22.99\n" +
              "            }\n" +
              "        ],\n" +
              "        \"bicycle\": {\n" +
              "            \"color\": \"red\",\n" +
              "            \"price\": 19.95\n" +
              "        }\n" +
              "    },\n" +
              "    \"expensive\": 10\n" +
              "}";
  
      public static final String json2 = "{\"store\":{\"book\":[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95},{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99},{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99},{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}],\"bicycle\":{\"color\":\"red\",\"price\":19.95}},\"expensive\":10}";
  }
  