Software /
code /
prosody
Changeset
10060:7a36b7ac309b 0.11
util.serialization: Cache default serialization instance (fixes #1389)
Most serialization uses still use the default serialize() and thus
duplicate much of the setup, which negates some of the performance
improvements of the rewrite.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 08 Jul 2019 02:46:27 +0200 |
parents | 10059:c8c3f2eba898 |
children | 10061:5c71693c8345 10092:4b3c129e96f2 |
files | util/serialization.lua |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util/serialization.lua Mon Jul 08 01:17:34 2019 +0200 +++ b/util/serialization.lua Mon Jul 08 02:46:27 2019 +0200 @@ -272,10 +272,15 @@ return ret; end +local default = new(); return { new = new; serialize = function (x, opt) - return new(opt)(x); + if opt == nil then + return default(x); + else + return new(opt)(x); + end end; deserialize = deserialize; };