[UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:] is unusable slow

Originator:steipete
Number:rdar://24298174 Date Originated:22-Jan-2016 02:56 PM
Status:Open Resolved:
Product:iOS Product Version:9.2.1
Classification:Performance Reproducible:Always
 
We were using [UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:] in PSPDFKit to decide if we should show a Definition menu item for text selection in PDF. However, we had to disable this because the lookup does a synchronous XPC and sometimes blocks the main thread for multiple seconds. It’s very unpredictable how long it does take.

Do you have any tips around usage? It seems like especially first use is very expensive and slow, but subsequent calls can also be very slow and we had situations where this blocked our app for 10 or more seconds, especially when our app itself also caused high load.

I don’t think a sample is needed here, it’s not really a bug, more an unfortunate design decision.

Could we call this from a background thread? The documentation doesn’t say anything about that.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!