-
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Currently, the selector! macro calls Sel::register, which in turn calls sel_registerName. This is inefficient compared to @selector in Objective-C.
On my machine, I measure:
| Initial | Subsequent | |
|---|---|---|
| Low | 2.15µs | 100ns |
| High | 2.45µs | 210ns |
This is relatively small compared to objc_msgSend. However, one of the goals of this crate is to be zero-cost compared to the same code written directly in Objective-C.
Related issues:
- Creating Objective-C selectors fails compilation at ld phase rust-lang/rust#80019
- Sending messages is inefficient because of selector lookup SSheldon/rust-objc#49
- Code fails to link on macOS with incremental compilation rust-lang/rust#51608
I made an attempt in nvzqz/rust-selector-example, however it fails to build at link time. See that repo for details.
The culprit seems to be the literal_pointers link option. It builds fine with just __DATA,__objc_selrefs, but I get "unrecognized selector" when trying to use the selector.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed