Here’s a visual way to get a sense of filter optimization in the local relay model. See quoted post for motivation.

Once you define the is_subset function you just call this for each filter on every other filter. This creates an array of true/false for each filter. This is equivalent to there being an arrow above each filter in the diagram. then you just remove each filter if the value is true for that index. Simple!

Adding this to the nostrdb api, might come in handy for anyone implementing the local relay model. nostr:note183q8djwxueg2qq9gpqv5vgrt5cgnle4pg9vv3qde48und7822r2s4ff9p5

Reply to this note

Please Login to reply.

Discussion

There may be one more nuance with respect to limits and until/since and merging these properly… will ponder. This makes the most sense when optimizing realtime feeds for now 🤔

I liked the word pruning. having redundant filters standby cause memory issues or just it is inefficient in terms of order of complexity?