samvera / ldp

Linked Data Platform.rb client
Other
16 stars 15 forks source link

optimize subject filtering #119

Closed no-reply closed 3 years ago

no-reply commented 3 years ago

the older implementation looped over each statement. within those loops it looped over each inlined resource URI. then it allocated an entirely new graph and shoveled resources into it.

RDF.rb doesn't have a delete-by-query, but we can do a lot better by: looping over the inlined resource URIs, doing a query (which is a hash lookup O(1)-ish), and then using #delete (which is also hash-driven) to drop matching statements. in addition to involving much faster data structure operations, this should avoid a large number of allocations in the normal case.