yosiat / panko_serializer

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

Add fast-path for type-casting Jsonb/Timestamp #159

Closed yosiat closed 2 months ago

yosiat commented 2 months ago

Add support for:

Benchmark - running benchmarks/sanity with ITEMS_COUNT of 2300, adding jsonb column to Posts.

Master:
{"label":"Panko_Simple_Posts_2300","ips":"87.56","allocs":"20721/2"}
{"label":"Panko_Simple_Posts_50","ips":"4,266.99","allocs":"469/2"}
{"label":"Panko_HasOne_Posts_2300","ips":"109.31","allocs":"9227/1"}
{"label":"Panko_HasOne_Posts_50","ips":"5,557.47","allocs":"227/1"}
{"label":"Panko_SimpleWithMethodCall_Posts_2300","ips":"82.25","allocs":"20722/2"}
{"label":"Panko_SimpleWithMethodCall_Posts_50","ips":"3,954.0","allocs":"472/2"}

Branch:
{"label":"Panko_Simple_Posts_2300","ips":"137.27","allocs":"9221/1"}
{"label":"Panko_Simple_Posts_50","ips":"6,605.73","allocs":"219/1"}
{"label":"Panko_HasOne_Posts_2300","ips":"112.41","allocs":"9227/1"}
{"label":"Panko_HasOne_Posts_50","ips":"5,726.94","allocs":"227/1"}
{"label":"Panko_SimpleWithMethodCall_Posts_2300","ips":"124.72","allocs":"9222/1"}
{"label":"Panko_SimpleWithMethodCall_Posts_50","ips":"5,972.18","allocs":"222/1"}