1.8 KiB
Introduction
JSON.simple uses json-test-suite to do performance testing. This is a simple performance testing against the reference implementation of JSON.org in a very simple scenario. It does not cover all aspects of applications in the real world. Its purpose is to provide a reference point to the user.
Steps
- Download the latest json-test-suite package from the home page of json-test-suite
- Unzip and run the following command in the directory of the package:
ant -f test.xml perf
- You may need to wait for a few minutes and then check the results from the following files:
TEST-org.json.test.perf.SimpleTest.txt
Results
The following is an arbitrarily selected result of ones generated by the above command. The millisecond value after each parser is measured by the time needed by parsing and retrieving the desired value from the sample data. The length of the sample data is about 620K characters (more precisely, UTF-16 code units) and the value '6.908319653520691E8' is a randomly generated value used for validating of the parsing result.
==sample==
len:621807
org.json.JSONObject :: 103.1 ms 6.908319653520691E8
org.json.simple.JSONParser :: 14.1 ms 6.908319653520691E8
org.json.simple.JSONParser with ContentHandler :: 5.5 ms 6.908319653520691E8
How does it work?
Please refer SimpleTest.java for details. You can also test JSON.simple against other libraries by removing the comment tags of SimpleTest.java. You may need to put their jar files and dependencies in directory 'lib' before running the command above.