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

Performance degradation in iOS simulator when using MLKit #45

Open
2 of 8 tasks
danielrhodes opened this issue Nov 1, 2023 · 1 comment
Open
2 of 8 tasks

Performance degradation in iOS simulator when using MLKit #45

danielrhodes opened this issue Nov 1, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@danielrhodes
Copy link

danielrhodes commented Nov 1, 2023

What happened?

This library was easy to install and use, but I noticed that I got a warning that I needed to use Rosetta in order to be compatible with other libraries.

Screenshot 2023-10-31 at 16 46 21

Additionally, I noticed there was a slow down in the app when using Rosetta in the Simulator, which makes some sense. I traced the issue back to Google's MLKit Podspec, which is excluding arm64 simulator builds, which means Xcode is forced to use x386 and then use Rosetta for the other libraries.

https://github.com/CocoaPods/Specs/blob/master/Specs/b/e/b/GoogleMLKit/4.0.0/GoogleMLKit.podspec.json#L18

Since the MLKit Cocoapod would obviously have arm64 support, you can force Cocoapods to not switch the architecture like so:

post_install do |installer|
    # put this at the end of this block
    installer.pods_project.build_configurations.each do |config|
       config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
end

This worked - the app built for the simulator without forcing me to use Rosetta. However, the performance degradation still persisted. An example of this is that the frame rate is seriously slow on a table when scrolling.

The production build does not appear to have this problem, or at least it is far less so. I'm not sure how to explain this!

Version

latest

Which ML Kit packages do you use?

  • @react-native-ml-kit/barcode-scanning
  • @react-native-ml-kit/face-detection
  • @react-native-ml-kit/identify-languages
  • @react-native-ml-kit/image-labeling
  • @react-native-ml-kit/text-recognition
  • @react-native-ml-kit/translate-text

What platforms are you seeing this issue on?

  • Android
  • iOS

System Information

System:
  OS: macOS 14.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 1.01 GB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.8.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.yarn/bin/yarn
  npm:
    version: 10.1.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2023.09.25.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.11.3
    path: /Users/<redacted>/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 15.0.1/15A507
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 18.0.1
    path: /usr/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/<redacted>/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.6
    wanted: ^0.72.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to Reproduce

Explained above.

@danielrhodes danielrhodes added the bug Something isn't working label Nov 1, 2023
@cortnum
Copy link

cortnum commented Oct 15, 2024

any news on this? I just added the ml translate kit to my flutter app and I see the same issue on iOS simulator. No problem with android emulator or on real devices though

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

No branches or pull requests

2 participants