mirror of
https://github.com/lucannez64/darling-lol.git
synced 2026-10-26 19:47:42 +00:00
Game process (ARAM Hexgate: 84 -> 127 FPS average, slowest stretches ~110): - Local pthread mutexes, condition variables and Mach semaphores are on by default in the game process only, with /tmp/rclol-no-local-* opt-outs. The main thread's darlingserver waits fell from 1.36 to 0.10 ms per frame. - Local semaphores: the count and the slot generation change in one compare-exchange, a destroy leaves a negative marker, the table is reset after fork, and names the table did not create go to the server. - Metal: drop identical re-binds (keyed on the Indium object, depth-stencil retained), pass blit resources by reference, and stop resetting vertex descriptors twice. - Core isolation of the main thread is opt-in (/tmp/rclol-core-isolation); it lowered FPS in its only match. - Optimized libc/libc++/Foundation overlays, AVX2 string primitives, real CPU topology and their installers and offline checks. Tools and docs: - tools/riot-match-capture: passive /proc sampler, user-space IP profiler and reports, plus a comparison against the game's netstats. - tools/riot-lsem-model and tools/riot-metal-bind-model: host models that extract the shipped code and check it. - tools/install-riot-metal-pair.sh installs Metal and Indium together. - Status, setup, testing and troubleshooting docs updated with the measured matches and the switch table; manifest file counts match the patches. Co-Authored-By: Claude Opus 5.5 <[email protected]>
37 lines
2.2 KiB
Python
37 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Optimize configured string helpers, preserving every other platform object.
|
|
|
|
Every src/string/generic source is recompiled at -O2 -fno-builtin (and
|
|
-fno-strict-aliasing for this old BSD C) with the object library's own defines
|
|
and includes, then relinked into build/riot-libsystem_platform.dylib. The AVX2
|
|
and REP paths for memcpy/memmove/memset/bzero/memcmp/memchr live in those same
|
|
sources and are selected from the commpage at run time, so this builder only
|
|
has to change the optimization level.
|
|
"""
|
|
from pathlib import Path
|
|
import shlex,subprocess,shutil,sys
|
|
sys.path.insert(0,str(Path(__file__).resolve().parent))
|
|
import riot_build_gate
|
|
root=Path(__file__).resolve().parent.parent
|
|
folder=root/'build/darling-src/build/src/external/libplatform'
|
|
flags={}
|
|
for line in (folder/'CMakeFiles/platform_obj.dir/flags.make').read_text().splitlines():
|
|
if line.startswith('C_') and ' = ' in line:
|
|
k,v=line.split(' = ',1);flags[k]=shlex.split(v)
|
|
inc=subprocess.check_output(['clang','-print-resource-dir'],text=True).strip()+'/include'
|
|
flags['C_INCLUDES']=[inc if x.startswith('/usr/lib/clang/') and x.endswith('/include') else x for x in flags['C_INCLUDES']]
|
|
link=shlex.split((folder/'CMakeFiles/platform.dir/link.txt').read_text())
|
|
recompiled=0
|
|
riot_build_gate.wait_until_free()
|
|
for original in list(link):
|
|
if not original.startswith('CMakeFiles/platform_obj.dir/src/string/generic/') or not original.endswith('.c.o'):continue
|
|
relative=original.split('platform_obj.dir/',1)[1].removesuffix('.o')
|
|
obj=root/('build/riot-platform-'+Path(relative).name+'.o')
|
|
subprocess.run(['clang',*flags['C_DEFINES'],*flags['C_INCLUDES'],*flags['C_FLAGS'],'-O2','-fno-builtin','-fno-strict-aliasing','-c',str(root/'build/darling-src/src/external/libplatform'/relative),'-o',str(obj)],check=True)
|
|
link[link.index(original)]=str(obj)
|
|
recompiled+=1
|
|
link[link.index('-o')+1]=str(root/'build/riot-libsystem_platform.dylib')
|
|
subprocess.run(link,cwd=folder,check=True)
|
|
print('built build/riot-libsystem_platform.dylib with',recompiled,'string objects at -O2')
|
|
p=root/'build/m810-platform-runtime';p.mkdir(exist_ok=True);shutil.copy2(root/'build/riot-libsystem_platform.dylib',p/'libsystem_platform.dylib')
|