It was just a very simple getting https requests from the browser vs sending ws messages, and WebSocket / Nostr won by 10x. Maybe working more on HTTP/3.0 support would speed things up and allow better caching, but it's probably just not worth it, as it's getting farther from the original Nostr protocol:

w=new WebSocket("wss://rbr.bio"); w.onopen=()=>console.log("opened"); w.onmessage=(x)=>console.log("message", x)

z=0;all=1000;time=Date.now();w.onmessage=(x)=>{if(JSON.parse(x.data)[0]=="EVENT") z++; if(z==all) console.log("time",Date.now()-time) }; for(i=0;i

// 2500ms

let u="https://rbr.bio/82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2/metadata.json"

time=Date.now(); a=[];for(i=0; i<1000; i++) a.push(fetch(u)); for(i=0; i

// 21035ms

Also tested JSON.parse:

time=Date.now();for(i=0; i<1000; i++) JSON.parse(data);Date.now()-time

// 2ms

Reply to this note

Please Login to reply.

Discussion

No replies yet.