[Webkit-unassigned] [Bug 251261] New: Large allocations in a tight loop perform poorly when using the JavaScriptCore C and Objective-C APIs
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Jan 27 04:29:14 PST 2023
https://bugs.webkit.org/show_bug.cgi?id=251261
Bug ID: 251261
Summary: Large allocations in a tight loop perform poorly when
using the JavaScriptCore C and Objective-C APIs
Product: WebKit
Version: WebKit Local Build
Hardware: Mac (Apple Silicon)
OS: macOS 13
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: kasperisager at hey.com
Consider the following C and Objective-C programs that perform 64 KiB allocations in a tight loop:
```
#include <JavaScriptCore/JavaScriptCore.h>
int
main () {
JSContextRef context = JSGlobalContextCreate(NULL);
JSStringRef source = JSStringCreateWithUTF8CString(
"for (let i = 0; i < 1e6; i++) new Uint8Array(1024 * 64)"
);
JSEvaluateScript(context, source, NULL, NULL, 1, NULL);
}
```
```
#include <JavaScriptCore/JavaScriptCore.h>
int
main () {
JSContext *context = [[JSContext alloc] init];
[context evaluateScript:@"for (let i = 0; i < 1e6; i++) new Uint8Array(1024 * 64)"];
}
```
When running these on my machine, I'm observing an 8x slowdown compared to running the same allocation loop in either Safari or using the jsc helper from the builtin JavaScriptCore framework (/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Helpers/jsc) and I cannot seem to figure out why. Both programs were compiled with clang using -O3.
--
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/20230127/b24777fa/attachment-0001.htm>
More information about the webkit-unassigned
mailing list