Changes between Initial Version and Version 1 of JSCRegExpProcessingAndJSCGoals

Oct 12, 2018 4:03:43 PM (4 years ago)
Jon Davis

Notes from 2018 WebKit Contributors Meeting


  • JSCRegExpProcessingAndJSCGoals

    v1 v1  
     1= JavaScriptCore RegExp Processing =
     2''presented by Michael Saboff''
     4Engine is called: YARR (Yet Another RegExp Runtime)
     6Has both interpreter and JIT backends
     8Uses backtracking algorithm (not DFA based)
     10First thing that happens is that the YARR parses a regex and converts it into a YarrPattern.
     12Then the YARR interpreter converts the YarrPattern into byte code that it can run.
     14Question: Why not use a DFA based system?
     15It takes a lot longer to compile a DFA system. Also, because JS regular expressions are irregular you wouldn’t be able to have a DFA based system for that.
     17Question: How would you know if you wanted to have more tiers of RexExps?
     18We would probably want to see what the areas the extra tier would help us. We would also want to know how often we are going see those cases.
     20Optimizations that YARR does right now:
     22Generate different code for different matching purposes. Sometimes the regexp is only used for matching other times they want to access the captured groups.
     24Check multiple adjacent characters at once (up to 8)
     26Remove unnecessary enclosing patterns: such as /.*abc.*/ which is the same as /abc/
     28Character class canonicalization. Such as converting [12345] into (1 <= c && 5 <= c) instead of if (c == 1) return match; else if (c == 2) …
     30= JSC Goals =
     31''presented by Saam Barati''
     33JetStream 2:
     35We think that the next thing JSC should optimize is BitInt.
     36We also want to improve our memory usage.
     38New Bytecode format:
     39It separates the parts of the Bytecode specific to a particular function from the core instructions. This lets us share the core instructions across processes or save it to disk. Hopefully, it is a win for startup and for non-jit cases.
     41JetStream 2, which is a new benchmark for JS performance that will be open sourced soon (TM).