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:
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.
Currently, the
selector!macro callsSel::register, which in turn callssel_registerName. This is inefficient compared to@selectorin Objective-C.On my machine, I measure:
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:
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_pointerslink option. It builds fine with just__DATA,__objc_selrefs, but I get "unrecognized selector" when trying to use the selector.