-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhaul #9
Overhaul #9
Conversation
When we know a variable isn't supposed to be re-assigned we should declare it w/
The constructor Array() creates a sparse array which is slower than a regular dense 1: There's a belief that invoking method fill() might turn a sparse array into a dense 1: |
That's exactly what I was thinking, but I didn't want to be "intrusive". I'll replace to
That's true, but it doesn't matter if
That's not a valid belief, because it's actually a fact. |
@GoToLoop Done. I edited the main comment to reflect the changes |
Lol, I realized the |
If I can't change
Yea, that Array(arrayLength) constructor call signature is sparse w/ or w/o keyword
My belief is that by now all modern JS engines should be smart enough to internally convert a sparse array to a dense 1 after a fill() method call. 🙏
Well, drops[] is an array of objects; therefore it can't be a typed array regardless. 🤷♂️
You've done that now. However, it's still adding objects using the This is my push() take on init_drops(): 💧 function init_drops(n) {
const drops = [];
n = ~~Math.abs(n);
while (n--) drops.push({
x: random(-150, 150),
y: random(-150, 150),
velocityX: random(-6, 6),
velocityY: random(-6, 6),
size: random(20, 300),
width: random(1, 40),
r: random(0, 255),
g: random(0, 255),
b: random(0, 255),
a: Math.random()
});
return drops;
} |
I agree and I also hope that. There seems to be a lot of
I focused so much on
True lol. I saw the About your code: it looks so clean! I think I'll add it now |
From 2^16 to 2^20 CUs, approximately ~128KB to ~1MB
Code by @GoToLoop [Link to Issue comment that contains the code](#9 (comment))
I'm still kinda hesitant of refactoring all examples to use |
The `if` has been turned into a `while` to handle the edge case that multiple cmds may need to be removed from history
RIP `var` lol. I thought IE didn't support `const` within loops, because MDN said it didn't support `let` in loops
I think there should be a feature to allow users to manually force the code to remove old history cmds. This is good because it improves performance by avoiding automatic garbage collection, and users would no longer need to reload the page to lose their entire history. A related feature would be to allow direct access to certain history entries, instead of sequential access. It seems simple to implement, just add a button that "teleports" back a number of entries specified in an input text-box. I'll try implementing both later (maybe some hours or days), when I have enough time. EDIT: Direct access is a feature that not even browser dev consoles, nor linux terminals have, and nobody has complained. I don't see any reason to add it |
You're welcome. I think I might need some more time to re-review some stuff. And I have a question about the I replaced those declarations only in the main file because I saw a few |
There was a tab instead of spaces
This isn't a terminal, but it kinda behaves like it is
Wait! I want to try to implement text rotation in I don't know if that should be a separate PR, or if I should do it in this PR. Update: I gave up lol |
they don't help much with readability
also renamed `part` in `sierpinski` to `half` to avoid name collision, and for "more accurate" self-commenting code
include radian/degree converters, and `range`
I guess this is ready now 🤷♂️. I'm awaiting feedback |
Hi
I decided to edit the "main" comment everytime a "major" commit updates something. So everything should be there, unless I forgot something
You're welcome! |
let
&const
querySelector
calls bygetElementById
. This is better for readability (I guess?). However, performance is more unpredictable (it depends on some factors), and there's an important difference detail between both