1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:15:07 +00:00
serenity/Userland/Libraries/LibJS
Andreas Kling f0482b61bf LibJS: Make Error stack trace generation faster with a line break cache
Generating Error objects got a lot slower after the introduction of
SourceCode in b0b022507b.

This was noticeable with `test-js` which generates a lot of errors,
so walking the source code over and over to compute (line, column)
was eating a ton of time.

This patch makes repeated lookups a lot faster by building a cache
of line break offsets in the source code. The cache is built on first
offset lookup, so we only pay for this in code that actually throws.

On my machine, this takes `test-js` runtime from 6.7 sec to 4.3 sec.
2022-11-24 16:06:20 +00:00
..
Bytecode LibJS+LibWeb: Make Runtime/AbstractOperations.h not include AST.h 2022-11-23 16:05:59 +00:00
Contrib/Test262 LibJS: Add missing <AK/TypeCasts.h> include in $262Object.cpp 2022-11-23 16:05:59 +00:00
Heap LibJS+LibWeb: Return non-const types from Ptr class operators 2022-11-19 14:37:31 +00:00
Runtime LibJS+LibWeb: Move JS::ModuleRequest to its own header file 2022-11-23 16:05:59 +00:00
Tests LibJS: Fix UTF-16 corruption in String.prototype.replace() 2022-11-19 11:30:06 -07:00
AST.cpp LibJS: Shrink Identifier's environment coordinate cache 2022-11-22 21:13:35 +01:00
AST.h LibJS+LibWeb: Move JS::ModuleRequest to its own header file 2022-11-23 16:05:59 +00:00
CMakeLists.txt LibJS: Make Parser::Error a standalone ParserError class 2022-11-23 16:05:59 +00:00
Console.cpp LibJS+js: Disable console debug messages outside Serenity only for js 2022-10-16 02:06:02 +03:30
Console.h LibJS+js: Disable console debug messages outside Serenity only for js 2022-10-16 02:06:02 +03:30
CyclicModule.cpp LibJS+LibWeb: Move JS::ModuleRequest to its own header file 2022-11-23 16:05:59 +00:00
CyclicModule.h LibJS+LibWeb: Make CyclicModule.h not include AST.h 2022-11-23 16:05:59 +00:00
Forward.h LibJS+LibWeb: Move JS::ModuleRequest to its own header file 2022-11-23 16:05:59 +00:00
Interpreter.cpp LibJS: Make Script and Module GC-allocated 2022-09-06 00:27:09 +02:00
Interpreter.h LibJS: Make Interpreter.h not include AST.h 2022-11-23 16:05:59 +00:00
Lexer.cpp LibJS: Treat '\\' as an escaped character in template literals 2022-11-15 12:00:36 +00:00
Lexer.h LibJS: Reduce AST memory usage by shrink-wrapping source range info 2022-11-22 21:13:35 +01:00
MarkupGenerator.cpp LibJS: Reduce AST memory usage by shrink-wrapping source range info 2022-11-22 21:13:35 +01:00
MarkupGenerator.h WebContent+LibWeb+LibJS: Report exceptions to the JS console 2022-10-15 01:25:12 +02:00
Module.cpp LibJS: Make CyclicModule.h not include PromiseCapability.h 2022-11-23 16:05:59 +00:00
Module.h LibJS: Add [[HostDefined]] field to Modules 2022-10-06 16:41:36 +02:00
Parser.cpp LibJS: Make FunctionNode::Parameter be a standalone FunctionParameter 2022-11-23 16:05:59 +00:00
Parser.h LibJS: Make FunctionNode::Parameter be a standalone FunctionParameter 2022-11-23 16:05:59 +00:00
ParserError.cpp LibJS: Make Parser::Error a standalone ParserError class 2022-11-23 16:05:59 +00:00
ParserError.h LibJS: Make Parser::Error a standalone ParserError class 2022-11-23 16:05:59 +00:00
SafeFunction.h LibJS: Don't register SafeFunction-to-function-pointer with JS::Heap 2022-10-20 15:16:23 +02:00
Script.cpp LibJS: Make Parser::Error a standalone ParserError class 2022-11-23 16:05:59 +00:00
Script.h LibJS: Make Script.h not include AST.h 2022-11-23 16:05:59 +00:00
SourceCode.cpp LibJS: Make Error stack trace generation faster with a line break cache 2022-11-24 16:06:20 +00:00
SourceCode.h LibJS: Make Error stack trace generation faster with a line break cache 2022-11-24 16:06:20 +00:00
SourceRange.h LibJS: Reduce AST memory usage by shrink-wrapping source range info 2022-11-22 21:13:35 +01:00
SourceTextModule.cpp LibJS+LibWeb: Make CyclicModule.h not include AST.h 2022-11-23 16:05:59 +00:00
SourceTextModule.h LibJS: Make SourceTextModule.h not include AST.h or Parser.h 2022-11-23 16:05:59 +00:00
SyntaxHighlighter.cpp LibJS: Remove a bunch of gratuitous JS namespace qualifiers 2022-04-03 15:19:33 +01:00
SyntaxHighlighter.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
SyntheticModule.cpp LibJS: Make Script and Module GC-allocated 2022-09-06 00:27:09 +02:00
SyntheticModule.h LibJS: Make Script and Module GC-allocated 2022-09-06 00:27:09 +02:00
Token.cpp LibJS: Make Token use the new double parser 2022-10-23 15:48:45 +02:00
Token.h Everywhere: Explicitly specify the size in StringView constructors 2022-07-12 23:11:35 +02:00