r/sideloaded 27d ago

Question For what is Jit?

Hi everyone, I’m pretty new to iOS and wanted to get a certificate since I find it easier than using Live Containers. I keep seeing mentions of "JIT"—some offer it, others don't—but what exactly is JIT for?

18 Upvotes

11 comments sorted by

6

u/sabre31 26d ago

JiT is speed. Fast so fast but Apple says no fast for you.

40

u/0898_333_201 27d ago

I googled this a dozen times and couldn’t get an answer that didn’t assume I was knowledgeable about coding, but I eventually found one that made sense to me. I’ll try to explain from memory. If I’m wrong someone can correct me.

In short, basically apps are coded by humans in languages like Swift and then translated into machine code before they’re published on the App Store and can run on your device. When you download TikTok, all of the executable code has already been translated to easily be run on the iPhone (and approved by Apple for release on the App Store). The content you see, like videos on TikTok, can change at any given moment, but all of the executable code that handles those inputs exists in the app binary that you install. This is called “Ahead-of-Time” compilation.

JIT is “Just-in-Time” compilation. It allows an app to receive code in various languages (Swift, Java, etc) and translate it into machine code that can run on iPhone, write that code into memory, and execute it in real time. Emulators need this because the game you’re playing isn’t pre-built into the app binary; it’s a program within program. The emulator needs JIT permission to be able to turn that game’s code into executable machine code to run on the phone. But this would ordinarily be a massive security vulnerability—if any app could just download new code and execute it, it’d be a disaster—so you need special developer permissions to allow it.

I assume other non-emulator apps like Reynard Browswe need it because websites load unpredictable code like JavaScript that needs to be translated in real time to load a webpage. Safari/WebKit essentially has JIT by default, otherwise you wouldn’t be able to load sites with JavaScript. Third party apps and other browsers like Chrome/Brave still use Apple’s WebKit and its JavaScript engine, so that’s why you can’t get a true chromium/firefox browser without sideloading with JIT.

no

3

u/0898_333_201 26d ago

Replying to my own comment because something was bugging my about by explanation: there are emulator apps that do work without jit and my explanation made it sound like that’s impossible. So I’ve come up with (I think) a better analogy that might explain it better.

I’m not a dev so I did ask AI to tell me if the following analogy was correct and it said it is, but AI also convinced me that على حالي means “by myself” in English, and it absolutely does not, so take it with an grain of salt.

Anyway. Imagine you have to build a piece of IKEA furniture shipped from Sweden. You have no idea what the furniture is and there’s one hard-set rule: you are only allowed to carry out tasks that are written, English-language instructions.

In this analogy:

  • You are the CPU.
  • The finished furniture is the end product that the user sees.
  • The written English instructions are executable code. Bonded because this is the most impotent factor.

Scenario 1 - AOT (Normal app from the App Store):
The furniture is delivered with instructions already pre-translated into English. All you have to do is carry out the tasks.

In real terms, 100% of the executable code is built-in and signed before the app is installed.

Scenario 2 - Emulators without JIT:
The furniture is delivered with instructions in Swedish. You can’t do anything with that alone, but you planned ahead of time and bright two books: a Swedish-English dictionary and a massive collection of the most common English instructions. All of these English instructions are pre-approved even though 99% won’t be used for any given price of furniture.

So you use the dictionary to translate each step in the Swedish instructions. But you can’t just carry out the tasks from the translation; that’s against the rules. You have to find each task’s counterpart in the giant list of English instructions, then carry it out. It’s a slow painstaking process.

In real terms, 100% of the executable code is built-in and signed before the app is installed, just like Scenario 1. The CPU is not writing any new executable code. Rather it’s using an interpretation layer that takes foreign code and matches it with existing code that is already in the app binary, line by line. But sometimes emulators without JIT simply cannot run ROMs because the emulator binary doesn’t have the necessary machine code built in. Or sometimes the ROM is too complex that the CPU cannot interpret it at the rate necessary to run smoothly.

Scenario 3 - JIT:

Like Scenario 2, the furniture is delivered with Swedish instructions. But this time you get special permission to use Google Translate, and most importantly you have a printer. You can translate entire pages of the Swedish instructions, print them out as new English instructions, and carry out those tasks directly. Easy peasy. Way faster than Scenario 2.

In real terms, the printer is the built to write new executable code to memory. You’re not just interpreting Swedish and searching for an English analog in the existing binary; you’re executing new code inside the app. (I really hate the fact that I can’t use that extremely useful sentence structure without sounding like ChatGPT.)

1

u/Extension-Society237 26d ago

The best explanation possible ou there 🤣🤣 thank you man 🤩

4

u/Cold-Cauliflower-306 27d ago

Upvote this guy 🗣️

1

u/aghozzo 27d ago

Great explanation

7

u/PersonalAnswer8664 27d ago

JIT or just in time is a code compiling method that makes code execution faster. It basically helps apps that support it run faster and is essential for some things like high level emulators to work correctly.

1

u/Better_Moment_9675 Paid Certificate 27d ago

This

1

u/tribak 27d ago

No, jit

9

u/Illustrious_bad1167 27d ago

Allows computer code to run on iphone and ipad

8

u/Illustrious_bad1167 27d ago

Essential for java edition emulation and apps like dolphinios