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

🐛 iOS optimization level bug #561

Closed
3 of 4 tasks
github984527 opened this issue Oct 29, 2021 · 6 comments · Fixed by #1466
Closed
3 of 4 tasks

🐛 iOS optimization level bug #561

github984527 opened this issue Oct 29, 2021 · 6 comments · Fixed by #1466
Labels
🐛 bug Something isn't working

Comments

@github984527
Copy link

What were you trying to do?

for ios,if the optimization level is faster ,the frame proccesser Plugins will don't work

Reproduceable Code

No response

What happened instead?

optimization level is faster or high

Relevant log output

No response

Device

iphone11 ios14.7

VisionCamera Version

^2.8.0

Additional information

@github984527 github984527 added the 🐛 bug Something isn't working label Oct 29, 2021
@mrousavy
Copy link
Owner

what is an optimization level?

@github984527
Copy link
Author

it's an xocde build setting item。

Specifies the degree to which the generated code is optimized for speed and binary size.

None[-O0]: Do not optimize. With this setting, the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter to any other statement in the function and get exactly the results you would expect from the source code.
Fast[-O1]: Optimizing compilation takes somewhat more time, and a lot more memory for a large function. With this setting, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time. In Apple's compiler, strict aliasing, block reordering, and inter-block scheduling are disabled by default when optimizing.
Faster[-O2]: The compiler performs nearly all supported optimizations that do not involve a space-speed tradeoff. With this setting, the compiler does not perform loop unrolling or function inlining, or register renaming. As compared to the 'Fast' setting, this setting increases both compilation time and the performance of the generated code.
Fastest[-O3]: Turns on all optimizations specified by the 'Faster' setting and also turns on function inlining and register renaming options. This setting may result in a larger binary.
Fastest, Smallest[-Os]: Optimize for size. This setting enables all 'Faster' optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size.
Fastest, Aggressive Optimizations[-Ofast]: This setting enables 'Fastest' but also enables aggressive optimizations that may break strict standards compliance but should work well on well-behaved code.

@mrousavy
Copy link
Owner

Okay and what does "don't work" mean? Do they not run? Do they crash? Are they slow? What gets printed to the Xcode logs/console? Need more details here.

@mrousavy
Copy link
Owner

Also, do Reanimated animations (UI Worklets) work with that setting?

@github984527
Copy link
Author

On the iOS side, I wrote my own frame processor for facial recognition. Everything was normal during debugging, but the frame plugin did not run after the archive was packaged. At first I thought it was a code problem. After two days, I didn’t find any code. The question, after thinking about it again, I found that the main problem is that it doesn't work after packaging. I think there may be something wrong with the compilation and optimization. I tried to set the Optimization Level to none and re-packaged it to run. The frame plug-in was indeed running normally. So I think it may be that the optimization level affects the injection of the frame plug-in method. I am not sure about the specifics.

@mrousavy
Copy link
Owner

I see.

Also, do Reanimated animations (UI Worklets) work with that setting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants