All Questions

Tagged with
Filter by
Sorted by
Tagged with
1
vote
1answer
64 views

Efficient and readable method for styling of javascript webcomponents

I have a web page that loads a very long list of custom web components, each with their own shadow DOM and a stylesheet shared by all instances. Originally, I included the stylesheet as css file ...
1
vote
1answer
510 views

Chat application - write to file and then save in database

I have followed this approach that is described here to implement a simple chat application: https://code.tutsplus.com/tutorials/how-to-create-a-simple-web-based-chat-application--net-5931 I'm ...
0
votes
1answer
47 views

Performant way for archiving image files in NodeJS on each user requests

Scenario: Images are uploaded to the server once in a while. Users send an API request for downloading all of those images that were uploaded to the server (Images reside in the server itself). ...
4
votes
1answer
768 views

Webpack and Lazy Load for large-scale Web Application

Background I am trying to develop with Webpack and JavaScript. Webpack would bundle all source code into one single file. When application becomes large, the file would be very large and cause ...
-1
votes
1answer
174 views

Modelling research paper data in JSON

I need to design an UI to edit a research paper, I don't have enough knowledge about the research domain but still I tried to do my best and thought to design a normalized schema. I am describing the ...
2
votes
1answer
744 views

How to manage multiple views in a single page JavaScript Application without a 3rd party library [closed]

I am building a JavaScript application that makes AJAX requests to a PHP API Back-end to load JSON data for different views. The app UI consist mainly of a left sidebar menu which has items loaded ...
2
votes
1answer
502 views

How can i test the performance of DOM manipulation code in JS

I want to test the performance of some code snippets in JS using: function perf() { var start = new Date() // the snippet codes var end = new Date() return end - start } then i wrote some ...
1
vote
0answers
493 views

Best way to handle large amount of objects

I'm building an javascript application where I need to register devices to an specific room. So I thought, I'm making my room_name as main key (room name is unique). And I'm going to add the devices ...
5
votes
2answers
382 views

Modelling an account manager in OOP

I have this task of modelling a system where given a group of users each can keep track of their expenses. The basic requirements are as followed: To be able to give credit to an user. Find all the ...
5
votes
4answers
9k views

How to handle large array operations in Javascript?

I have two Float32Arrays each one of which is 1.6*10^7 in length(floating point array). Using JS I retrieve them from server and add them element by element. My webpage stops responding and I get the ...
0
votes
0answers
94 views

AngularJS: cost of deep watching infrequently changed object trees

I am working on a complex widget with a "preferences" object tree with 50-100 objects and 3-5 properties in each object. Each property is watched by Angular and controls how some aspects of the data ...
0
votes
4answers
5k views

Nested For Loops JavaScript

I have an app which gets data from the database (MongoDB) in JSON format. The returned data contains nested arrays and I want to access the values in the nested arrays. The returned JSON format looks ...
5
votes
1answer
834 views

What is the most efficient way to implement a RESTful client app?

I am working on a web application for ranking some products based on some factors. The user send a search query to 5 restful webservices which by their turn send a response in a JSON format and ...
84
votes
6answers
20k views

Does immutability hurt performance in JavaScript?

There seems to be a recent trend in JavaScript towards treating data structures as immutable. For example, if you need to change a single property of an object, better to just create a whole new ...
5
votes
1answer
277 views

Tips for optimizing javascript code. a year's worth of Dates

I am playing around with the date object, i made a function that generates a bunch of dates, and applies some function on each date. For a month's worth, it is fine about 2.5ms on my pc, ff and ...
1
vote
1answer
2k views

Correct usage of Bluebird promise

This is related to this question on promise performance. The current top answer states that using new Promise is an anti-pattern in bluebird And that promisify should be used instead. I understand ...
194
votes
1answer
58k views

Why are native ES6 promises slower and more memory-intensive than bluebird?

In this benchmark, the suite takes 4 times longer to complete with ES6 promises compared to Bluebird promises, and uses 3.6 times as much memory. How can a JavaScript library be so much faster and ...
14
votes
3answers
3k views

why is the latter function 10% faster although it must create the variables over and over again?

var toSizeString = (function() { var KB = 1024.0, MB = 1024 * KB, GB = 1024 * MB; return function(size) { var gbSize = size / GB, gbMod = size % GB, mbSize = gbMod /...
7
votes
2answers
2k views

Where is the evidence for the performance of Node.js?

A lot of developers, especially ones who haven't used Node.js in production, seem to believe that Node.js is faster than other interpreted languages such as PHP, Python, and Ruby. These claims ...
7
votes
2answers
4k views

Should I group all of my .js files into one large bundle?

One of the difficulties I'm running into with my current project is that the previous developer spaghetti'd the javascript code in lots of different files. We have modal dialogs that are reused in ...
1
vote
2answers
2k views

Polling vs events pros and cons in JavaScript

I'm bit of a novice to JavaScript so I've been wondering on positive and negative sides of using polling compared to using events in JavaScript? When does one use one or the other? By polling I ...
3
votes
1answer
1k views

How many Angular Controllers and/or Directives is too many?

I'm building a large, editable data table with angular, and I'm trying to figure out what the best practice is. The table will be a couple of hundred rows, with a couple of dozen columns, so upwards ...
1
vote
2answers
13k views

Why is Javascript faster than Jquery? [closed]

I was reading a thread and saw this post, which says that Javascript is faster than Jquery because it uses native code. But why is the use of native code faster? Is this always the case? What ...
2
votes
1answer
3k views

best way to store data from ajax call

I am writing a web-application in which I am retrieving data's from server through AJAX requests and the generate HTML content dynamically. I have some data to load, generate HTML from it and append ...
1
vote
3answers
1k views

Add javascript to all pages (for caching), or only to the pages that require the scripts (for a smaller page size)?

I'm using bits of javascript on my website for an image gallery, smooth scrolling, etc. These scripts are not used on every page (not every page has an image gallery for example). However, the scripts ...
3
votes
4answers
1k views

Will object reuse optimize this often-called function?

Suppose I have a function that I need to call a lot, maybe a few thousand times on every mouse down or mouse move. It uses an instance of a function (class), called Transform: function func1(a, b, c) ...
4
votes
3answers
3k views

Anonymous function performance - setTimeout

According to Gregory Baker & Erik Arvidsson (Google), creating a named function and then passing that to setTimeout is actually faster than creating an anonymous function (reference: Optimizing ...
7
votes
2answers
1k views

Does javascript support numerically indexed arrays with a more optimized algorithm than an associative array?

I know that Python, Perl, Java, Lua and obviously C (as it's the only array that's in ANSI standard afaik) support faster looking of numerically indexed arrays than doing a hash lookup or anything ...
4
votes
1answer
8k views

Cost of setInterval in Javascript

I've got some code that I want to run when certain HTML elements are added to the page. To do this, I have a "runOnRender" function: runOnRender: function (func, args, interval) { var ...
2
votes
1answer
257 views

What is the most performant CSS property for transitioning an element?

I'm wondering whether there is a performance difference between using different CSS properties to translate an element. Some properties fit different situations differently. You can translate an ...
3
votes
2answers
669 views

Is script grouping and minification counter-productive?

On a web page I have 1 script tag that contains all my minified JavaScript (I use SquishIt for .NET). However I see that a few people prefer to load their scripts in parallel using something like ...
6
votes
1answer
3k views

Performing client-side OAuth authorized Twitter API calls versus server side, how much of a difference is there in terms of performance?

I'm working on a Twitter application in Ruby on Rails. One of the biggest arguments that I have with other people on the project is the method of calling the Twitter API. Before, everything was done ...
3
votes
1answer
564 views

Specifically for JS, CSS, HTML: what is the difference between optimization, compression, minification, tidying, concatenation?

When we talk about source code and the file which contains the code like CSS, HTML, JavaScript and we also talk about performance of a web site or application, what is the differences between these ...
2
votes
4answers
2k views

Measures of Javascript engine performances over time? [closed]

Since the beginning of the Javascript race -- which I would situate around Google Chrome launch in 2008 -- the improvement in the Javascript engine performances have been impressive. The web is ...
47
votes
10answers
45k views

Why Should I Avoid Inline Scripting?

A knowledgeable friend recently looked at a website I helped launch, and commented something like "very cool site, shame about the inline scripting in the source code". I'm definitely in a position ...
3
votes
1answer
181 views

Alternative methods for maintaining JavaScript source

I'm looking for other options for maintaining my personal JavaScript namespace. The problem I'm having boils down code Organization Vs. Performance. I would simply LOVE to be able to separate major ...