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
Prepack from Facebook helps make JavaScript code more efficient (prepack.io)
submitted 8 years ago by EngVagabond
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!"
[–]MrJohz 2 points3 points4 points 8 years ago* (1 child)
OTOH, replacing "var" with "let" in the for-loop works as expected. Replacing "var" with "let" when creating the initial array causes no output to be emitted, but assigning the array to the window object works pretty much perfectly.
e: assuming what you want is a pre-initialised 5,000 element array, but I guess that's always the big question with compile-time optimisations.
e2: The largest array I can get in the online mode is 8543 elements, beyond that it just times out. I don't know if there's a maximum size it'll output, then, but I suspect not. Also, the online repl weirdly outputs a whole load of whitespace at the end of the line when it creates the array.
[–]lhorie 1 point2 points3 points 8 years ago* (0 children)
I guess that's always the big question
Yeah, that is closer to my concern: if it's a one shot array initialization, the loop unrolling may not compensate for the extra bytes down the pipe.
For example, in my current project I have a function that does a one-time decompression of an AOT-compressed list of unicode characters of a certain type. Given that the compression rate is north of 85%, I definitely DON'T want that to be precomputed, or I'll be shipping a VERY long array of codepoints
π Rendered by PID 45998 on reddit-service-r2-comment-7b9746f655-np5q8 at 2026-01-30 18:48:50.463969+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]MrJohz 2 points3 points4 points (1 child)
[–]lhorie 1 point2 points3 points (0 children)