What is Nostr?
Graham Sutherland / Polynomial /
npub1wgp…q3pa
2024-11-17 19:41:08
in reply to nevent1q…5au0

Graham Sutherland / Polynomial on Nostr: In the unedited code they're looping over a List<T> every time they add a new object ...

In the unedited code they're looping over a List<T> every time they add a new object to it, using IndexOf, to patch up ownership references. the problem is that IndexOf is O(n) and requires a generic comparison to be performed between the objects, which is very very slow. the comparison alone was responsible for 50% of CPU time. and this pattern exists because they have a specific schematic data object collection type with a restrictive API that wraps the List<T>. rather messy.
Author Public Key
npub1wgp97tfljcqvknue9axjpul0c0ct76n9pef89tt6jgxhz6ny3jqsnlq3pa