-
Notifications
You must be signed in to change notification settings - Fork 60
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
Extremely poor performance on iOS UIWebView #72
Comments
Wow that's not good to hear. It will take me some time to get that uiwebview code running. In the meantime, if it's truly the regexes that are slow, have you tried precompiling the templates and shipping those, instead of compiling on page load? ~ Drew
|
that's a good idea but unfortunately we can't run it from server side at the moment, the function which causes the issue is lexer.advance(), because it loops over all the regex and somehow it triggers JSC::Yarr::matchDisjunction which blocks the whole browser. a little substr before doing regex.exec() makes it better though, plus caching the template function, it still takes around 10 seconds to finish |
To precompile you don't need to run vash on the server, just as part of There may be some trickiness with globals (the cli tool assumes vash is Yip yip, On Wed, May 13, 2015 at 4:14 PM, Norman Xu [email protected] wrote:
|
thx for the suggestion, but the situation we have is a little complicated. vash is used as template engine which converts user created template into widgets, because the template is user created... we can't do it on the deployment and because we are bound to some commercial super expensive java CMS system, it will take a while for me to figure out proper server execution of node js or rhino js... thx anyway, we will do some temporary workaround on our side for now |
I did some googling. Since you have a working harness, I'm wondering if you could test something for me: In tokens.js, could you try removing the 'EMAIL' and the associated regex, and then run your examples again? I believe that's the only one that has nested parenthesis, and that might be forcing the regex to run in interpreted mode instead of compiled / JITed. |
I already tried that but unfortunately it doesn't help too much... |
I am curious: have you seen similar performance problems with other template engines in this older WebView? I wonder how they got around it. Another idea I had, was you could host a small server that only accepts text and returns a compiled vash template. I assume that's out of the question given java-CMS-land, but wanted to suggest it regardless. |
Hi @kirbysayshi thanks for the suggestion, we already workarounded it by running the vash in our editor's browser and then save the result to server rather than run it on user's browser. for the similar performance problems, sorry I haven't tried yet, but I reckon its all about the regexes, if one template use too much regex.exec it will be slow on uiwebview, apple recently released WKWEBVIEW in ios8 which will be much more faster but i guess it needs a while for user and apps to catch up |
Performance is acceptable in Mobile Safari, but in UIWebView because its using old javascript core, its extremely slow due to the heavily used regular expressions.
http://codepen.io/anon/pen/KpzgKP
You can easily modify the code based on https://github.com/msencenb/UIWebView-Example, point it to above url and run it on real device to see how it performance, it takes minutes to render the page...
The text was updated successfully, but these errors were encountered: