I've started my exploration of using @timbray's Quamina project for saving some compute time in the filters module of

Currently the GoAP storage backends iterate over resources (usually stored as raw JSON bytes), unmarshal them into GoActivityPub object structs, and *only* then apply the custom filtering logic on those objects. Since the majority of the objects generally fail the filtering logic, all that JSON decoding is wasted compute time and makes things slower.

Ideally quamina will allow me to check the raw JSON payloads directly against the filters, streamlining the execution and speeding things up. :goose_hacker:

I have finally I made significant progress on this.

The final code looks like this:

github.com/go-ap/filters/blob/

For a list of filters that uses, we generate two patterns for Quamina: one for a denormalized raw document, and one for normalized raw document (they usually are stored in a normalized form, where an Activity's object/actor properties are flattened to their IRIs, but we can't know which it is unless we unmarshall it, which we want to avoid)

Another improvement from my complain from 4 days ago is that I was regenerating the patterns and initializing quamina for every new document, instead of one time per collection load.

0

If you have a fediverse account, you can quote this note from your own instance. Search https://metalhead.club/users/mariusor/statuses/116147663003454651 on your instance and quote it. (Note that quoting is not supported in Mastodon.)