Comments (2)
I originally wanted to have something like a little table of benchmarks in the README, but given the number of different configurations the module (and other modules) can run on and the differing results of the benchmarks, I felt it'd be better to provide the scripts so people could benchmark it themselves, rather than potentially misleading anyone when the benchmarks I provide differ drastically from what they get on their setup.
For example, different versions of LuaJIT change the relative benchmarks, these also differ between Lua 5.1, 5.2 and 5.3. In cases where LPeg is being used, json.lua running on non-JIT Lua is slower (for obvious reasons), but in cases where LuaJIT is being used json.lua tends to out-perform the libraries I tested which do use LPeg (with or without LuaJIT) -- though LPeg is intentionally disabled in the benchmark scripts as its focus is pure Lua implementations.
That being said, here is what I get on my setup using the provided benchmark scripts, across different versions of Lua. json4lua's decoding is omitted because it took longer than I was willing to wait for it to decode the data.
LuaJIT 2.0.2
[decode]
Lua version : LuaJIT 2.0.2
CPU name : Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz
../json.lua : 0.022s [x1] (min: 0.0214s, max 0.0234s)
dkjson.lua : 0.0656s [x2.98] (min: 0.0647s, max 0.067s)
jfjson.lua : 0.0805s [x3.65] (min: 0.0793s, max 0.0816s)
[encode]
Lua version : LuaJIT 2.0.2
CPU name : Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz
../json.lua : 0.0302s [x1] (min: 0.0298s, max 0.0308s)
dkjson.lua : 0.0413s [x1.37] (min: 0.0404s, max 0.0419s)
jfjson.lua : 0.0517s [x1.71] (min: 0.0513s, max 0.0522s)
json4lua.lua : 0.0499s [x1.65] (min: 0.0495s, max 0.0502s)
Lua 5.1
[decode]
Lua version : Lua 5.1
CPU name : Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz
../json.lua : 0.117s [x1] (min: 0.116s, max 0.119s)
dkjson.lua : 0.131s [x1.12] (min: 0.129s, max 0.134s)
jfjson.lua : 0.131s [x1.12] (min: 0.129s, max 0.134s)
[encode]
Lua version : Lua 5.1
CPU name : Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz
../json.lua : 0.0583s [x1] (min: 0.057s, max 0.0615s)
dkjson.lua : 0.0692s [x1.19] (min: 0.0684s, max 0.0703s)
jfjson.lua : 0.096s [x1.65] (min: 0.0954s, max 0.0964s)
json4lua.lua : 0.0911s [x1.56] (min: 0.0898s, max 0.0928s)
Lua 5.2
Lua version : Lua 5.2
CPU name : Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz
../json.lua : 0.124s [x1] (min: 0.122s, max 0.128s)
dkjson.lua : 0.138s [x1.11] (min: 0.133s, max 0.141s)
jfjson.lua : 0.138s [x1.11] (min: 0.136s, max 0.142s)
[encode]
Lua version : Lua 5.2
CPU name : Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz
../json.lua : 0.0629s [x1] (min: 0.0626s, max 0.0633s)
dkjson.lua : 0.0761s [x1.21] (min: 0.0754s, max 0.0775s)
jfjson.lua : 0.105s [x1.67] (min: 0.103s, max 0.109s)
json4lua.lua : 0.0935s [x1.49] (min: 0.0921s, max 0.0949s)
Lua 5.3
[decode]
Lua version : Lua 5.3
CPU name : Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz
../json.lua : 0.131s [x1] (min: 0.127s, max 0.14s)
dkjson.lua : 0.135s [x1.03] (min: 0.131s, max 0.14s)
jfjson.lua : 0.136s [x1.04] (min: 0.134s, max 0.145s)
[encode]
Lua version : Lua 5.3
CPU name : Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz
../json.lua : 0.0599s [x1] (min: 0.0576s, max 0.0624s)
dkjson.lua : 0.0736s [x1.23] (min: 0.0724s, max 0.0749s)
jfjson.lua : 0.0992s [x1.66] (min: 0.0971s, max 0.102s)
json4lua.lua : 0.0929s [x1.55] (min: 0.0905s, max 0.101s)
from json.lua.
I understand, thank you for sharing your local results.
from json.lua.
Related Issues (20)
- Floating point numbers with dot causing error HOT 2
- Unable to encode 'sparse array's HOT 5
- 一个json字符串,decode成table,之后再把这个table encode成json,俩个json不一样! HOT 5
- How to install it for Tengine
- Empty object encodes as array HOT 2
- decode simple table error HOT 1
- Not working with NGNIX HOT 5
- Large numbers lose precision when decoding HOT 2
- bad argument #1 to 'rawget' (table expected, got string)
- decoding of object with 'duplicate' key HOT 2
- Annotated Tags Please
- There is an idea to optimize the code for json.lua HOT 25
- json encode error HOT 2
- pcall json.decode failing, "attempt to call a table value" HOT 1
- No functions support HOT 1
- Output is all on one line
- Uh how do i use this in lua... the readme.md was very vague HOT 5
- Large numbers serialized incorrectly HOT 3
- Encoding runs in worst-case quadratic time HOT 4
- Decoding fails for JSON with array of strings within an object.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json.lua.