NDK 2.8: "Fast and steady"
NDK-2-8-Fast-and-steady-hzfwnt
PABLOF7z
Magical Other Stuff Maximalist.
2 min read
I'm happy to announce the release of NDK 2.8 which comes with a plethora of new performance improvements, threading capabilities and many many other things.
TL;DR:
- Optimistic signature-verification
- Threaded signature-verification
- Threads, threads, threads! s/o
- Dexie cache adapter becomes massively more efficient
Onwards 🫡
Performance boost
Optimistic signature-verification
NDK can now be configured to perform signature verification of events asynchronously. This means that events are assumed to be valid and pushed to a queue.
When an invalid signature is received, a global event is emitted for the application to handle accordingly (i.e. alert the user, disconnect from the evil relay, etc)
Web Worker Signature Verification
Signature verification can be offloaded to a web worker (meaning that it runs on it's own thread) with the workers/sig-verification that comes with NDK. Other web workers can be implemented and hooked to NDK.
Dexie Cache Adapter Improvements
This cache adapter now works mostly as an LRU in-memory cache; while using IndexDB mostly just as a persistence storage.
Threading
has paved the way to show how broken thread rendering is in nostr multiple-times. This release includes a bunch of helper functions that should make proper thread rendering incredibly obvious.
When fetching events, these functions can be used to make sense of what's the right ordering, what are replies, what is part of the main thread, etc.
The main entry point to these threading utility functions is eventThreads, which can be provided a set of fetched events and will return, in order, the events that belong to the thread. All other events can be rendered as replies.
There are many more very useful functions along with it that can be found on src/threads. Examples of how to use these can be found on the open sourced Highlighter codebase.
Help keep these ideas circulating
This is an independent project. If you'd like to help support it, you can make a contribution. But there's no obligation at all. Reading, sharing, and coming back is already a form of support.
Read also
1
This post has been deleted.
2
Will importing Wikipedia destroy Wikifreedia, the nostr-based wikipedia alternative?

Want to publish here too? No sign-up, and the text stays yours. Learn how to start
Replies (0)
Loading…
