Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add experiment to skip creating UIViews altogether for constants #881

Merged
merged 5 commits into from
Apr 12, 2018

Conversation

Adlai-Holler
Copy link
Member

@Adlai-Holler Adlai-Holler commented Apr 12, 2018

This also fixes a missing exp_unfair_lock constant 😅 .

This can avoid some pretty serious pre-main time.

The diff is hard to read, so here's what it does:

  • Create static NSNumber *'s for the two BOOLs. If you're not in the experiment, these will be set during ASInitializeFrameworkMainThread. If you are in the experiment, the initializer function does nothing.
  • In the two accessor functions e.g. BOOL ASDefaultAllowsGroupOpacity() we have a dispatch_once that checks the static to see if it was set in the initialize function, and if not it selects the default based on UIKit documentation (by reading Info.plist).
  • There was some thread-unsafety before which is maintained. Namely, the statics were not thread-affined and they still aren't but the dispatch_once has a memory barrier which should make us safer even than before.

@TextureGroup TextureGroup deleted a comment Apr 12, 2018
@TextureGroup TextureGroup deleted a comment Apr 12, 2018
Copy link
Contributor

@maicki maicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Adlai-Holler Adlai-Holler merged commit 071bd73 into master Apr 12, 2018
@Adlai-Holler Adlai-Holler deleted the AHSkipInit branch April 12, 2018 17:14
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
…tureGroup#881)

* Add experiment to skip creating UIViews altogether for constants

* Update changelog

* Do it right

* Annotate function

* Skip all the work entirely
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants