[Webkit-unassigned] [Bug 258706] New: JS markdown parser performs 50x slower in JSC compared to V8, likely due to regex
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Jun 29 19:02:09 PDT 2023
https://bugs.webkit.org/show_bug.cgi?id=258706
Bug ID: 258706
Summary: JS markdown parser performs 50x slower in JSC compared
to V8, likely due to regex
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: jarred at jarredsumner.com
Created attachment 466880
--> https://bugs.webkit.org/attachment.cgi?id=466880&action=review
Reproduction that jsc shell can run
I've attached a repro that can be executed in jsc shell directly. It prints out the length of the output file after parsing it.
❯ hyperfine "node out.mjs" "jsc -m out.mjs"
Benchmark 1: node out.mjs
Time (mean ± σ): 123.8 ms ± 21.1 ms [User: 94.7 ms, System: 11.0 ms]
Range (min … max): 77.9 ms … 153.5 ms 16 runs
Benchmark 2: jsc -m out.mjs
Time (mean ± σ): 6.803 s ± 0.211 s [User: 2.511 s, System: 0.025 s]
Range (min … max): 6.507 s … 7.196 s 10 runs
Summary
'node out.mjs' ran
54.95 ± 9.53 times faster than 'jsc -m out.mjs'
If we profile it with Instruments, we can see that majority of time is spent in JSC::Yarr
2.16 s 97.6% 2.15 s JSC::Yarr::Interpreter<char16_t>::matchDisjunction(JSC::Yarr::ByteDisjunction*, JSC::Yarr::Interpreter<char16_t>::DisjunctionContext*, bool)
3.00 ms 0.1% 3.00 ms void std::__1::__introsort<std::__1::_ClassicAlgPolicy, JSC::ARM64Assembler::jumpsToLink()::'lambda'(auto&, auto&)&, JSC::ARM64Assembler::LinkRecord*>(JSC::ARM64Assembler::LinkRecord*, JSC::ARM64Assembler::LinkRecord*, auto, std::__1::iterator_traits<JSC::ARM64Assembler::LinkRecord*>::difference_type)
2.00 ms 0.0% 2.00 ms JSC::BytecodeGenerator::variable(JSC::Identifier const&, JSC::ThisResolutionType)
5.00 ms 0.2% 2.00 ms void JSC::LinkBuffer::copyCompactAndLinkCode<unsigned int>(JSC::MacroAssembler&, JSC::JITCompilationEffort)
1.00 ms 0.0% 1.00 ms sys_icache_invalidate
3.00 ms 0.1% 1.00 ms JSC::ASTBuilder::SourceElements JSC::Parser<JSC::Lexer<unsigned char>>::parseModuleSourceElements<JSC::ASTBuilder>(JSC::ASTBuilder&)
1.00 ms 0.0% 1.00 ms ash_map.HashMapUnmanaged([]const u8,void,src.bun.StringHashMapContext,80).growIfNeeded
1.00 ms 0.0% 1.00 ms _platform_memset
1.00 ms 0.0% 1.00 ms __bzero
1.00 ms 0.0% 1.00 ms JSC::DFG::DefMethodClobberize<JSC::DFG::(anonymous namespace)::LocalCSEPhase::BlockCSE<JSC::DFG::(anonymous namespace)::LocalCSEPhase::LargeMaps>>::operator()(JSC::DFG::PureValue) const
https://github.com/oven-sh/bun/assets/709451/f12bdd48-4bbe-4dd7-83f8-94d7dd920204
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230630/77f6f018/attachment-0001.htm>
More information about the webkit-unassigned
mailing list