ring

mpenet 2019-05-09T15:08:14.103300Z

@ikitommi Surprising. But I meant you could write your own version of derived-map that's basically a simple wrapper for map functions (assoc/get/dissoc) with an inlined switch on the correct piece of code and fallback on normal fns for extras (like extmap for records). But yeah protocols are easier but I have the feeling that's not something that would be added to ring without resistance (I could be wrong)

mpenet 2019-05-09T15:09:44.104700Z

also I imagine some adapters might not do caching of the returned values (ex when parsing headers) while others do. So sometimes acting as a simple method proxy might not be the best thing to do, but I guess that's a concern for the implementer of the protocol (or whatever is used)

ikitommi 2019-05-09T15:58:09.111700Z

the def-derived-map seems to emit fast access functions for all fields (`.get__0`...). Immutant exposes the ServerExchange as a key so we could extend the Immutant Request Type to satisfy a new common protocol. I think this is best of both worlds: a map-like request to be compliant with the ring spec, a zero-copy construction and can be used via (the new) protocols for really fast access.

ikitommi 2019-05-09T16:00:03.115100Z

Could add the new protocols to in reitit-ring and rewire the internal middleware & interceptors to use those. And a new reitit-immutant module to make it fast with Immutant.

ikitommi 2019-05-09T16:01:12.117200Z

Aleph doesn't expose the Netty Request, so would need a PR for it to work. Could try that after seeing if the perf gains are visible in the real usage.

ikitommi 2019-05-09T16:02:51.119900Z

getting the protocols into ring.... Wouldn't break anything and the default would be to make maps satisfy those. Would like to hear what @weavejester thinks about this.

ikitommi 2019-05-09T16:03:30.120800Z

btw, didn't know about __extmap, thanks.

2019-05-09T17:17:51.121200Z

@ikitommi What protocols?