frioux / DBIx-Class-Helpers

https://metacpan.org/pod/DBIx::Class::Helpers
20 stars 38 forks source link

Hella Fast JSON Encoder #73

Open frioux opened 8 years ago

frioux commented 8 years ago
15:52:26 ribasushi | so - first of all JSON _en_coding is rather well contained, best seen here: https://metacpan.org/source/SRI/Mojolicious-7.0/lib/Mojo/JSON.pm#L209-260
15:53:26      frew | ok
15:53:51 ribasushi | then if you teach DBIC to recognize a specifc HRI-like class on the lowest possible level like so:
                   | https://metacpan.org/source/RIBASUSHI/DBIx-Class-0.082840/lib/DBIx/Class/ResultSet.pm#L1382-1390
15:53:59      frew | ooooooooh
15:54:18 ribasushi | you can then assemble a parser like so: https://metacpan.org/source/RIBASUSHI/DBIx-Class-0.082840/lib/DBIx/Class/ResultSet.pm#L1432-1439
15:54:26 ribasushi | and DBIC will use it properly
15:55:17 ribasushi | https://metacpan.org/source/RIBASUSHI/DBIx-Class-0.082840/lib/DBIx/Class/ResultSource/RowParser/Util.pm
15:55:27 ribasushi | search for hri_style in this file
15:55:37 ribasushi | it will make it clear how to implement json_style as well
15:55:46 ribasushi | once all of this is assembled/compiled
15:55:53      frew | cool
15:55:56 ribasushi | you have completely functioncall-free JSON assembly
15:56:02      frew | right
15:56:06 ribasushi | just like you have the infres/hri one
15:56:28 ribasushi | which while still in perl space, is going to be a simple loop, and I am pretty sure will beat any transfer to C space