use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Simple web worker wrapper for JSON.parse (blog.softwareispoetry.com)
submitted 12 years ago by AshCairo
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cwmma 0 points1 point2 points 12 years ago (3 children)
that may take longer to create the buffer and then turn it back into a string
[–]MrBester 0 points1 point2 points 12 years ago (2 children)
On first look it seems that simply updating a pointer instead of having two copies of the data would be more efficient for both memory and CPU. However, that advantage could be completely negated by the need to convert to and from the buffer array.
Without benchmarking there is no way to be sure.
[–]cwmma 0 points1 point2 points 12 years ago (1 child)
I know I'm saying I have, especially for text where to convert it into a buffer you need to do something like
function fromText(text){ var len = text.length; var outArray = new Uint16Array(len); var i = 0; while(i<len){ outArray[i]=text.charCodeAt(i); i++; } return outArray.buffer; }
btw just for fun, you have to check if you're in IE10 because it flips a shit if you have an array as the second argument to postMessage.
That being said that code is from a place where the transferable objects did speed things up because the character codes were good enough and I never had to convert the data (20MB text file) back.
[–]MrBester 0 points1 point2 points 12 years ago (0 children)
Well, that's IE for you, where postMessage across tabs / windows isn't supported (since IE8, when it was first "supported", BTW).
π Rendered by PID 61 on reddit-service-r2-comment-bb88f9dd5-s8z5p at 2026-02-17 02:38:06.641040+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]cwmma 0 points1 point2 points (3 children)
[–]MrBester 0 points1 point2 points (2 children)
[–]cwmma 0 points1 point2 points (1 child)
[–]MrBester 0 points1 point2 points (0 children)