Skip to content

Instantly share code, notes, and snippets.

View stefan-wullems's full-sized avatar
🥷

Stefan Wullems stefan-wullems

🥷
View GitHub Profile

Caching models rethink

Now that we are not dependent on routeFromModel I was thinking: Maybe we should do a rethink of the way we store models in admin only.

Everything from every page is cached

I think caching is a performance/complexity tradeoff that requires reasoning and a conscious decision. Right now we have all the page models stored as Maybe SomeModel in a large record, we literally cache everything in every model for every page, even pages that have nothing we would like to cache.

I think we should rethink this and come up with an opt-in way of caching.

type Id entity =
Id String
unwrap : Id entity -> String
eq : Id entity -> Id entity -> Bool
decode : Decoder (Id entity)
encode : Id entity -> Value
-- Entities -------------
type Quantity unit =
Quantity Int
-- SUPPORTED UNITS ---------
type Newtons = Newtons
type Meters = Meters
type Amperes = Amperes
-- COMBINE -----------------
{-------------------------
src/Lib/Language
-------------------------}
module Lib.Language
type Language
= Swedish
| English
| ..
@stefan-wullems
stefan-wullems / compression_proposal.md
Last active August 24, 2020 19:13
Exivity: Compression of request and response data

Compression of request and response data

Primer

Glass needs to handle a lot of data. Almost all of which comes from Proximity in the JSON:API format. A feature of this format is that every request has exactly the same structure, with only the data differing. Following the JSON:API format has many benefits, but one of its drawbacks is the fact that JSON:API messages contain a lot of boilerplate (informationless structure). Because glass has to handle a lot of data, this boilerplate can increasingly slow down our requests the more data is transmitted (compared to raw information). What I would like to propose is the supporting of compressed messages by proximity, an optional feature that strips these responses from their boilerplate, allowing us to sidestep some transmission overhead.

How much work is this

I think that this could be achieved within a cycle of 4 weeks. In proximity we would have to setup a system to compress the data and in glass we would have to setup one to decompress it. The comp