All Questions
Tagged with javascript performance
8,461 questions
Best practices
1 vote
2 replies
59 views
Optimising a function by caching the results or removing the function enirely?
In JavaScript, how costly is a function call? I ask because I'm looking at, at the start of a function, checking whether the results have already been calculated and, if so, just use them (assuming ...
Advice
0 votes
2 replies
75 views
What prevents Javascript memory leaks in software applications?
I was thinking back to WinJS or WinUI with Windows Universal Applications (WUA) from about 10 years ago. I am wondering how it compiled and avoided typical architecture errors. If there is no memory ...
7 votes
1 answer
139 views
Why are prototype extensions so much slower than functions?
I compared the speed of normal JavaScript functions and prototype extensions. function NormalizeSpace(str) { return str.trim().replace(/\s+/g, " "); } String.prototype.NormalizeSpace = function () ...
-2 votes
1 answer
129 views
Is this a valid JavaScript approach for sorting large arrays of unique integers efficiently? [closed]
I’m experimenting with sorting large arrays of unique integers in JavaScript and came up with a simple approach. I’m curious if it’s a recognized pattern or if there are potential pitfalls I might be ...
0 votes
1 answer
61 views
Mobile Auto-Scroll Jumps Between Transcript Positions
On mobile, when the transcript scrolls automatically to follow the currently playing dialogue, the view doesn’t stay fixed. Instead, it jumps: First it moves to the current dialogue, then it suddenly ...
-4 votes
1 answer
110 views
Comparing for loops vs spread and concat for merging arrays in JavaScript — performance and best practices? [closed]
I'm learning JavaScript and practicing merging arrays. Here's one of the methods I wrote using two for loops: const arr1 = [4, 5, 7, 9, 8]; const arr2 = [-1, -2, 0, 12]; const arr3 = []; for (let i = ...
1 vote
0 answers
56 views
ReactJS input fields lag on large dynamic table with live calculations
I'm working on a ReactJS application where I have a table with an infinite number of rows (user can keep adding rows). Each row has 10 input fields (columns). There is one constant total row at the ...
0 votes
0 answers
73 views
0x, the flame graph generator tool for node, is missing a lot of data in the generated flame graph
I'm trying to profile my heap implementation, so I've created this script: class BinaryHeap { array; comparator; constructor(comparator) { this.array = []; this.comparator ...