Repository navigation
Conversation
The return type of an @objc call (and the object type of an @autoproperty) was resolved with Base.eval, which lowers and interprets the expression at top level, costing ~100µs whenever the type is a non-trivial expression like id{NSString}. Resolve the common shapes (names, qualified names, curly applications) by walking the AST directly, falling back to eval for anything else. Reduces @objc expansion time by ~35% for Expr return types. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@objcwrapper and @autoproperty emitted '@static if !is_available(...)' blocks, whose condition @static evaluates with Core.eval on every downstream expansion — ~100µs each, even with no availability annotation. The macros already hold the availability as a value, so perform the check directly and only emit the throw when unavailable; the timing is identical since @static would have evaluated at the same expansion. Reduces @objcwrapper expansion time by ~40%, and @objcproperties by ~120µs per property. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every @objcwrapper emitted identical Base.getproperty/setproperty!/ propertynames forwarders for its class. Lowering a method definition costs ~300µs, so these three accounted for ~20% of the total top-level cost of a wrapper definition. Define them once on Object instead; typeof(object) is concrete after inlining, so property inference and constant folding are unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
maleadt
marked this pull request as draft
August 13, 2026 13:23
Member
Author
|
Speeds up things locally, but curiously slows down Metal.jl. So marked draft again. |
try_resolve_type constructed Some(x) and used map/broadcast over the
resolved values, minting Some{Type{NewClass}} and related specializations
for every newly defined wrapper class. Each new class thus forced fresh
inference of the widening/broadcast machinery (~9ms per class), more than
undoing the savings of resolving types without eval: expanding a
wrapper+properties block went from 11ms to 18ms.
Use @nospecialize, Some{Any}, and a Vector{Any} loop so resolution
compiles once, and restrict the getproperty branch to module lookups
(anything else falls back to eval as before). Brings the block back
down to 9.3ms, now genuinely faster than before the resolver.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.