Skip to content

mujs performance improvement or support quickjs #13131

@ahaoboy

Description

@ahaoboy

Expected behavior of the wanted feature

Mujs is a JavaScript engine designed for small devices, but devices typically used for video playing have sufficient performance, so it's possible to modify some of mujs's compilation parameters to enhance performance.

For example, the 'JS_ASTLIMIT' defaults to 100, some bundlers uses comma expression optimization for size reduction. This can result in code similar to the following directly throwing a 'too much recursion' error.

function f() {
  return 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100;
}

f()

Additionally, the 'REG_MAXCLASS' compilation option defaults to 16, which causes some third-party librarys' regular expressions to fail. 'JS_STACKSIZE' defaults to 256. When executing a bundled large JavaScript file, it often exceeds 1 MB, sometimes leading to direct stack overflow.

Alternative behavior of the wanted feature

Is it possible to support the QuickJS engine? QuickJS supports ES6 syntax and has significantly better performance compared to mujs. To ensure ES5 compatibility, a considerable amount of compatibility work is needed, resulting in increased file size.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions