ios - Improving UIWebView initialization time -
my company uses uiwebview display ads. issue i'm having initializing uiwebview appears expensive; profiling time profiler shows [uiwebview alloc] initwithframe:cgrectmake(0,0,500,500)] take 31–40ms. enough cause noticeable frame drops in games running @ 60 fps.
is there way workaround slow initialization time? current ideas create uiwebview when app launches (but before gameplay has started), , reuse (potentially creating pool of them reuse, how uitableviewcell works) or try , see if wkwebview has better performance.
here findings:
wkwebviewnot initialize faster. creatingwkwebviews took similar amount of time creatinguiwebviews (in 1 test did, took 46ms create 2wkwebviews.- the first web view created takes longer create subsequent web views. first 1 takes 31–42 ms; subsequent ones take ~11ms create. news here creating first web view when e.g. app launches allows future webviews created more cheaply, avoiding 40ms hit while game running.
- creating pool of
uiwebviews solution use case. creating webviews @ app launch , reusing them, avoid causing frame drop while game running.