mirror of
https://github.com/fangyidong/json-simple.git
synced 2025-12-06 15:30:54 +03:00
27 lines
1.8 KiB
Markdown
27 lines
1.8 KiB
Markdown
#### Introduction ####
|
|
JSON.simple uses [json-test-suite](http://code.google.com/p/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 ####
|
|
1. Download the [latest json-test-suite package](http://code.google.com/p/json-test-suite/downloads/list) from the home page of json-test-suite
|
|
1. Unzip and run the following command in the directory of the package:
|
|
```
|
|
ant -f test.xml perf
|
|
```
|
|
1. 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](http://json-test-suite.googlecode.com/files/sample.zip) 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](http://code.google.com/p/json-test-suite/source/browse/trunk/src_perf/org/json/test/perf/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. |