yosiat / panko_serializer

High Performance JSON Serialization for ActiveRecord & Ruby Objects
https://panko.dev
MIT License
592 stars 36 forks source link

Json Columns: performance improvements #63

Closed yosiat closed 4 years ago

yosiat commented 4 years ago

Until this commit we took json strings out of db and did JSON.parse on them.

This commit changes this to:

Benchmarks:

master:

{"label":"Panko_ActiveRecord_SimpleWithJson_Posts_2300","ips":"93.59","allocs":"29919/0"}
{"label":"Panko_ActiveRecord_SimpleWithJson_Posts_50","ips":"4,296.59","allocs":"669/0"}

this commit:

{"label":"Panko_ActiveRecord_SimpleWithJson_Posts_2300","ips":"146.93","allocs":"9219/0"}
{"label":"Panko_ActiveRecord_SimpleWithJson_Posts_50","ips":"6,650.14","allocs":"219/0"}

less allocations and faster!