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

The possibility to speed up UTM SE by WKWebView. #6501

Open
KusakabeShi opened this issue Jul 19, 2024 · 4 comments
Open

The possibility to speed up UTM SE by WKWebView. #6501

KusakabeShi opened this issue Jul 19, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@KusakabeShi
Copy link

KusakabeShi commented Jul 19, 2024

JIT is not allowed in iOS, but the javascript engine itself is JIT enabled.

I found a project called jslinux, which is basically run qemu in browser engine, which enables JIT technology I think.

And I write a simple python benchmark, test it on jslinux and UTM SE

This is jslinux running in Google Chrome in iOS 17:
image

This is UTM SE downloaded from App store:
image

The jslinux(32s) is faster than UTM SE(62s).
Although the cpu architecture is different(risc-v/aarch64), so that the result is not direct comparable.

But I'm curious do we have the possibility to speedup UTM SE by running qumu in the WKWebView in iOS?

The script:

#!/usr/bin/python3
#Python CPU Benchmark by Alex Dedyura (Windows, macOS, Linux)

import time
import platform
import subprocess

print('Python CPU Benchmark by Alex Dedyura (Windows, macOS(Darwin), Linux)')
print('Arch: ' + subprocess.run(['uname', '-a'], capture_output=True, text=True).stdout,end="")
print('Python: ' + platform.python_version())

print('\nBenchmarking: \n')

start_benchmark = 100  # The number of iterations in each test
repeat_benchmark = 0    # The number of repetitions of the test
max_repeat_benchmark = 10    # The number of repetitions of the test
max_time = 12
# Initializing a variable to accumulate execution time
total_duration = 0

start_s = time.perf_counter()
# Starting the test cycle
for attempt in range(max_repeat_benchmark):
    repeat_benchmark += 1
    start = time.perf_counter()  # Recording the initial time

    # Nested loops for performing calculations
    for i in range(start_benchmark):
        for x in range(1, 1000):
            3.141592 * 2 ** x  # Multiplying the number Pi by 2 to the power of xx
        for x in range(1, 10000):
            float(x) / 3.141592  # Dividing x by Pi
        for x in range(1, 10000):
            float(3.141592) / x  # Dividing the number Pi by x

    end = time.perf_counter()  # Recording the end time
    duration = round(end - start, 3)  # Calculate and round up the execution time
    total_duration += duration  # Adding the execution time to the total amount
    print(f'Time: {duration}s')  # We output the execution time for each iteration
    if total_duration > max_time:
        break
# Calculate and output the average execution time
average_duration = round(total_duration / repeat_benchmark, 3)
print(f'Average (from {repeat_benchmark} repeats): {average_duration}s')
@KusakabeShi KusakabeShi added the enhancement New feature or request label Jul 19, 2024
@KusakabeShi KusakabeShi changed the title The possibility to speedup UTM SE by JavaScriptCore. The possibility to speed up UTM SE by JavaScriptCore. Jul 19, 2024
@itjustcrashed
Copy link

This is genuinely a smart idea.

@osy
Copy link
Contributor

osy commented Jul 20, 2024

This was looked into before and I think it's just too much work to integrate. If someone volunteers to make a fork, we will maintain it when it works. This was how UTM SE came into being.

@SkywalkerIron
Copy link

it‘s a great idea

@sinoru
Copy link

sinoru commented Jul 20, 2024

As I know, JSCore does not allow JIT on iOS, iPadOS still now. https://forums.developer.apple.com/forums/thread/746159

@KusakabeShi KusakabeShi changed the title The possibility to speed up UTM SE by JavaScriptCore. The possibility to speed up UTM SE by WKWebView. Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants