malli

https://github.com/metosin/malli :malli:
ikitommi 2020-09-11T09:50:54.200800Z

@tekacs not 100% sure about your use case, what about using transformers?

ikitommi 2020-09-20T15:12:24.028900Z

does the new -simple-schema solve this?

ikitommi 2020-09-11T09:55:37.204700Z

I recently tested the end-to-end performance of JSON and realized we could plug malli into the jsonista pipeline: define a malli schema, create a jsonista functional-decoder out of it which picks just the defined keys from the JSON stream and runs (already optimized) value transformation for it. As there are no intermediate conversions, it should be MUCH faster.

ikitommi 2020-09-11T10:01:01.208400Z

• old-style json: stream --json-decode--> edn --schema-decode--> domain-data --json-encode--> string --ring-adapter--> bytes • malli+jsonista: stream --json-and-schema-decode--> domain-data --json-and-schema-encode--> bytes

borkdude 2020-09-11T10:33:25.209400Z

@ikitommi That's exactly an issue that I posted a couple of years ago in the compojure-api channel :) Awesome that this will now be supported via malli!

borkdude 2020-09-11T10:34:21.210Z

This is typically what you do in typed languages: write (de)serialization code which results in very efficient JSON processing. But in Clojure we typically just parse the entire blob

borkdude 2020-09-11T10:35:30.210400Z

If you have a working example of this, I'd be very interested

borkdude 2020-09-11T10:41:45.211700Z

since jsonista is also based on jackson-core I might be able to switch/add from cheshire to jsonista without adding very much binary size. if we then also add malli and reitit and http-kit server ... in babashka I mean. small web-apps :)

ikitommi 2020-09-11T14:55:02.214800Z

that would be great! Would like to get vertx working with clj + graalvm at some point. After that, one could write a code that can run really fast with jvm, with low resources with graalvm and with bb for scripting.

ikitommi 2020-09-11T14:57:46.218500Z

reitit+jsonista+porsas+pohjavirta is still one of the fastest jvm stacks in techempower db-query tests. It's a silly benchmark, but, still.

ikitommi 2020-09-11T15:01:09.220Z

don't have an example of the json+malli, just know it's possible. Will do.