Is there a way to create a TypedArray from an ArrayBuffer without using new keyword in Javascript?Does `postMessage` or yielding to the event loop or similar sync shared memory?Create GUID / UUID in JavaScript?What is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?Creating multiline strings in JavaScriptHow to extend an existing JavaScript array with another array, without creating a new arrayWhat is the 'new' keyword in JavaScript?Open a URL in a new tab (and not a new window) using JavaScriptHow do I remove a particular element from an array in JavaScript?How can I add new array elements at the beginning of an array in Javascript?Correct way to transfer TypedArrays?
Colloquialism for “see you later”
1980s live-action movie where individually-coloured nations on clouds fight
Is it legal for a bar bouncer to confiscate a fake ID
Russian word for a male zebra
Why we don’t make use of the t-distribution for constructing a confidence interval for a proportion?
Did Milano or Benatar approve or comment on their namesake MCU ships?
CROSS APPLY produces outer join
Active low-pass filters --- good to what frequencies?
Is a lack of character descriptions a problem?
Importance of Building Credit Score?
Overlapping String-Blocks
How can I end combat quickly when the outcome is inevitable?
Is it expected that a reader will skip parts of what you write?
How did old MS-DOS games utilize various graphic cards?
Group Integers by Originality
With Ubuntu 18.04, how can I have a hot corner that locks the computer?
How do I prevent employees from either switching to competitors or opening their own business?
Alternate way of computing the probability of being dealt a 13 card hand with 3 kings given that you have been dealt 2 kings
How is water heavier than petrol, even though its molecular weight is less than petrol?
Why can my keyboard only digest 6 keypresses at a time?
What ways have you found to get edits from non-LaTeX users?
Soft question: Examples where lack of mathematical rigour cause security breaches?
Rebus with 20 song titles
Fixing obscure 8080 emulator bug?
Is there a way to create a TypedArray from an ArrayBuffer without using new keyword in Javascript?
Does `postMessage` or yielding to the event loop or similar sync shared memory?Create GUID / UUID in JavaScript?What is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?Creating multiline strings in JavaScriptHow to extend an existing JavaScript array with another array, without creating a new arrayWhat is the 'new' keyword in JavaScript?Open a URL in a new tab (and not a new window) using JavaScriptHow do I remove a particular element from an array in JavaScript?How can I add new array elements at the beginning of an array in Javascript?Correct way to transfer TypedArrays?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am using transferables to communicate between the main thread and the worker. I realized the communcation creates GC activity because after receiving the buffer, I'm converting the buffer to a typed array using the new keyword:
var ary = new Float32Array(buffer);
Is there a way to re-use a TypedArray or getting a view of a buffer without creating GC activity?
javascript web-worker transferable
add a comment |
I am using transferables to communicate between the main thread and the worker. I realized the communcation creates GC activity because after receiving the buffer, I'm converting the buffer to a typed array using the new keyword:
var ary = new Float32Array(buffer);
Is there a way to re-use a TypedArray or getting a view of a buffer without creating GC activity?
javascript web-worker transferable
i doubt there is a way
– GottZ
Mar 24 at 18:02
add a comment |
I am using transferables to communicate between the main thread and the worker. I realized the communcation creates GC activity because after receiving the buffer, I'm converting the buffer to a typed array using the new keyword:
var ary = new Float32Array(buffer);
Is there a way to re-use a TypedArray or getting a view of a buffer without creating GC activity?
javascript web-worker transferable
I am using transferables to communicate between the main thread and the worker. I realized the communcation creates GC activity because after receiving the buffer, I'm converting the buffer to a typed array using the new keyword:
var ary = new Float32Array(buffer);
Is there a way to re-use a TypedArray or getting a view of a buffer without creating GC activity?
javascript web-worker transferable
javascript web-worker transferable
asked Mar 24 at 17:59
Oğuz EroğluOğuz Eroğlu
718
718
i doubt there is a way
– GottZ
Mar 24 at 18:02
add a comment |
i doubt there is a way
– GottZ
Mar 24 at 18:02
i doubt there is a way
– GottZ
Mar 24 at 18:02
i doubt there is a way
– GottZ
Mar 24 at 18:02
add a comment |
1 Answer
1
active
oldest
votes
I don't think there is, no. ArrayBuffer
is pretty much a black box without a typed array or DataView
to look into it, and you can't change the buffer on an existing typed array or DataView
.
On platforms that support it, you can create a SharedArrayBuffer
that both the main and worker thread have access to, which wouldn't have the GC problem since each side would reuse its wrapper array. Just make sure you gatepost access to it via postMessage
or Atomics
(more about that in this question's answer).
But sadly, most browsers disabled SharedArrayBuffer
in response to Spectre, and the last I checked only Chrome has re-enabled it (on platforms where its site isolation feature is enabled).
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55326814%2fis-there-a-way-to-create-a-typedarray-from-an-arraybuffer-without-using-new-keyw%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I don't think there is, no. ArrayBuffer
is pretty much a black box without a typed array or DataView
to look into it, and you can't change the buffer on an existing typed array or DataView
.
On platforms that support it, you can create a SharedArrayBuffer
that both the main and worker thread have access to, which wouldn't have the GC problem since each side would reuse its wrapper array. Just make sure you gatepost access to it via postMessage
or Atomics
(more about that in this question's answer).
But sadly, most browsers disabled SharedArrayBuffer
in response to Spectre, and the last I checked only Chrome has re-enabled it (on platforms where its site isolation feature is enabled).
add a comment |
I don't think there is, no. ArrayBuffer
is pretty much a black box without a typed array or DataView
to look into it, and you can't change the buffer on an existing typed array or DataView
.
On platforms that support it, you can create a SharedArrayBuffer
that both the main and worker thread have access to, which wouldn't have the GC problem since each side would reuse its wrapper array. Just make sure you gatepost access to it via postMessage
or Atomics
(more about that in this question's answer).
But sadly, most browsers disabled SharedArrayBuffer
in response to Spectre, and the last I checked only Chrome has re-enabled it (on platforms where its site isolation feature is enabled).
add a comment |
I don't think there is, no. ArrayBuffer
is pretty much a black box without a typed array or DataView
to look into it, and you can't change the buffer on an existing typed array or DataView
.
On platforms that support it, you can create a SharedArrayBuffer
that both the main and worker thread have access to, which wouldn't have the GC problem since each side would reuse its wrapper array. Just make sure you gatepost access to it via postMessage
or Atomics
(more about that in this question's answer).
But sadly, most browsers disabled SharedArrayBuffer
in response to Spectre, and the last I checked only Chrome has re-enabled it (on platforms where its site isolation feature is enabled).
I don't think there is, no. ArrayBuffer
is pretty much a black box without a typed array or DataView
to look into it, and you can't change the buffer on an existing typed array or DataView
.
On platforms that support it, you can create a SharedArrayBuffer
that both the main and worker thread have access to, which wouldn't have the GC problem since each side would reuse its wrapper array. Just make sure you gatepost access to it via postMessage
or Atomics
(more about that in this question's answer).
But sadly, most browsers disabled SharedArrayBuffer
in response to Spectre, and the last I checked only Chrome has re-enabled it (on platforms where its site isolation feature is enabled).
answered Mar 24 at 18:07
T.J. CrowderT.J. Crowder
713k12612741362
713k12612741362
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55326814%2fis-there-a-way-to-create-a-typedarray-from-an-arraybuffer-without-using-new-keyw%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
i doubt there is a way
– GottZ
Mar 24 at 18:02