The possibility to speed up UTM SE by WKWebView.
- Dominant language
- Swift
- Stars
- 35.5k
- Forks
- 1.8k
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 7
Description
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:

This is UTM SE downloaded from App store:

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')
```
Contributor guide
Assessment
This issue has not been assessed yet.