GithubHelp home page GithubHelp logo

Benchmark results about json.lua HOT 2 CLOSED

rxi avatar rxi commented on August 22, 2024
Benchmark results

from json.lua.

Comments (2)

rxi avatar rxi commented on August 22, 2024

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.

vsergeev avatar vsergeev commented on August 22, 2024

I understand, thank you for sharing your local results.

from json.lua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.