Questions tagged [performance]
Questions related to improving application performance, this can be range from selection software architecture to selection of algorithms.
826
questions
3
votes
1
answer
331
views
Is C usually a last resort?
I've been learning C recently.
I've completed a number of coding challenges on websites like codewars in C, and I always find myself wishing I had something like Python's flexible data structures. In ...
2
votes
1
answer
453
views
Saving and reading files in user specific application data in C or C++
Most useful or reasonably complex applications need to save data such as user settings or saved games or browser history. I have been working on applications and games in C or C++ but I am not sure ...
0
votes
1
answer
102
views
I want my Docker container to use more of the host's CPU resources
I have a DigitalOcean droplet on which I have deployed a Docker container (Docker version: 20.10.14), but my app is sometimes slow, therefore I would like to allocate more resources to it.
The droplet ...
-1
votes
1
answer
88
views
Fast methods to consolidate 20 csv files into one xml file [closed]
We have 2 systems Legacy & New and I have to migrate the data from the legacy system to the new system.
The legacy system exports the data in .csv format while the new system accepts the data in ...
1
vote
1
answer
147
views
How do I narrow down a search space if symmetries are equivalent?
I have an algorithm that runs a search through every combination of a 5x5 grid where each cell can have 3 values, looking to see which combinations meet certain conditions. This gives 3^25 naive ...
2
votes
0
answers
142
views
Speed up implementation of "log transform" on 2D image
I'm working on an implementation of the "log transform" operator on an image for C++, and we currently have it formulated as follows (python code). Note we use log10 instead of the natural ...
8
votes
3
answers
206
views
Choosing one of two memory blocks to deallocate: Does age affect fragmentation?
First question here, so preemptive apologies if I've committed some faux-pas. Additionally, I am aware that this question is about possibly the micro-est of micro-optimizations ever, and "micro-...
0
votes
0
answers
41
views
Is CQRS applicable with total ordered views and sharding?
Merry Christmas everybody.
I am trying to solve a theoretical sharding problem out of my own curiosity and I think CQRS can help me achieve properties that I want of my data.
I have too much data for ...
15
votes
6
answers
6k
views
Accessing enemies' locations quickly in a 2D game
I have a simple 2D game which has squares, player (teal) and enemies (red).
class Game {
List<List<Square>> map;
Player player;
List<Enemy> enemies; ...
My problem is that I ...
0
votes
1
answer
128
views
Best software architecture approach for a single core system
Objective: Designing a data intensive application(myApp) C++ on Linux/RTOS which runs on a single core cpu, there are also 150 other applications share the same core with high priority than myApp.
How ...
8
votes
5
answers
6k
views
Is code written inline faster than using function calls?
I wrote some script in Python that creates a giant 2D matrix (1000x1000 or bigger) and fills it with random numbers. And after that, it goes through every element of the matrix and changes the number ...
0
votes
0
answers
102
views
Avoiding reloading entities many times with EF Core and Mediatr
We have a largeish .NET Core project which uses Mediatr and EF Core. Many of the queries look something like:
public class GetSomeInformation : IRequest<string>
{
public int DocumentId { get;...
0
votes
3
answers
556
views
Why isn't a counter used to avoid nested for loops for index based operations?
Let's assume we have a method that we want to run as fast as possible and it needs to loop on a 2D array, naturally we would do a nested for loop as such:
int[][] arr = new int[3][3];
for(int ...
34
votes
7
answers
9k
views
Does Garbage Collection Scan The Entire Memory?
I was reading a bit about garbage collectors and I am wondering if the garbage collector of a program scans the entire heap memory or what is allocated to it? If it reads the entire system memory, ...
1
vote
3
answers
232
views
Does it always take the same amount of time to retrieve the same thing from collection?
for example:
const arr = [1,2,3,4];
const coordinate = [arr[0] + 2, arr[0] + 1];
here arr[0] is written out twice, when the code is executed would it literally go and find same value twice or would ...
1
vote
1
answer
169
views
Can I assume "Perf" is a commonly understood abbreviation for "Performance" in the context of Software Engineering? [closed]
I have been using "Perf" when writing about performance of some pieces of software (in tools, pull requests, etc.) but was wondering recently if this was an appropriate practice.
Can I ...
1
vote
1
answer
84
views
Can we reliably use unaligned scalars on contemporary hardware?
Processors have come a long way in their handling of unaligned data - from crashing at the very notion of it, through suffering severe penalties, all the way to having almost no impact.
I suppose it ...
-1
votes
2
answers
236
views
Should I store non-editable items lists in a database?
Relational database is mostly used for storing editable user data.
But how about storing non-editable lists of information? Possible examples are:
GUI-related: main menu items, selectbox options, ...
-1
votes
2
answers
165
views
Performance hit after non-functional refactoring
I was asked to refactor some C++ code recently for the purposes of increasing unit testing coverage. The problem was that the code was tightly coupled on one compilation unit, so we had the equivalent ...
35
votes
10
answers
9k
views
Am I right that switching programming languages will have little impact on the scalability of a CRUD API?
An external consultant to our team advised us to rewrite our SaaS offering (essentially a CRUD API) in .NET because this is more "scalable" than using Node.js (or Ruby on Rails, Flask, etc.)....
-1
votes
2
answers
106
views
Difficulty understanding how denormalization results in more storage necessary
I am having difficulty understanding how denormalization results in more storage necessary.
For example, let's say that in a normalized relation, there's Table 1 and Table 2. In order to join Table 1 ...
0
votes
1
answer
881
views
Java: Is there a performance difference between variable assignment vs. inline usage?
Is there any performance detriment to assigning variables vs using them inline. I'm guessing this WOULD be worse if a method was returning primitive and I was 'boxing' it (e.g. method returning int, ...
2
votes
1
answer
380
views
Difference between `Class.X` and `Class.getX()`?
Might be a silly question or something I might have just messed up in my head but here we go...
I saw a code example of someone using getPos() in their own class to retrieve the current position of an ...
9
votes
5
answers
990
views
Today I wrote "tests" for the testing code. Was it the right thing? Is it a smell?
My application has big integration with the database. Classes that use the database are very crucial for the system, so I write small unit tests for classes that I call Repository. The reason behind ...
3
votes
1
answer
449
views
How to store a huge volume of time-series datapoints in an efficient way?
We have an application producing 5k-10k datapoints per second. Each datapoint has more than one metric, alongside its time of creation.
We are looking for an efficient, scalable way to store this huge ...
1
vote
2
answers
807
views
Preventing parent component re-rendering of a big React component when you "Lift State Up"
I have a very big form - let's call it <MyForm> - consisting of the following:
text fields and dropdowns
custom selector made of selectable cards
table input (for this example 50 rows with each ...
-3
votes
1
answer
50
views
Server performance and CMS scalability [closed]
I have been given the job of a colleague who has resigned and I don't know where to start. I hope you can give me some hints:
It is about a CMS made from scratch (Javascript/jQuery/PHP/MySQL) which ...
0
votes
0
answers
60
views
Do datacenters have conditions that might throttle component clock speed (either intentionally or automatically)?
Here is the question.
On a 2.2 GHz processor with 6 physical threads and 6 hyperthreads, I see performance on the order of 3-10s for a particular job involving OpenCV.
I do not specify that the ...
0
votes
0
answers
218
views
Improving performance of 'Weighted/prioritized left shuffle algorithm'
I wrote a prioritized/weighted left shuffle algorithm (the code is copied from my open source C# project Fluent Random Picker).
What does that mean? You've got some values and each of them has a ...
9
votes
4
answers
557
views
How to document alternative code I considered but didn't go with due to performance?
I write code in R, and often find myself attempting to optimize the code for better performance. In a given script that tackles a specific problem, I test different code alternatives and compare them ...
14
votes
3
answers
4k
views
What are the complexities of a binary search?
I recently asked a question on CodeReview SE where using a binary search was recommended, and the author of the answer proved that it was faster than my implementation. During my research on the topic,...
0
votes
1
answer
89
views
Right way to combine data between Mongo and DynamoDB
I am looking for a way of dealing with the following situation:
1- Have an items collection in MongoDB
2- Have a users collection in DynamoDB
3- Each document in the items collection has a "...
2
votes
1
answer
1k
views
Multiple if condition optimization
Often I find conditional statements such as:
if (life_max < max):
if (expand):
do life_max = max
else:
if (life_max > max) and not (expand):
do life_max = max;
Although readable, ...
0
votes
1
answer
69
views
How should I model/design these aggregates?
I am new to DDD and I am trying model/design the aggregates of the following domain.
The domain consists of several concepts:
Assessment Models (AM) which contain Enabling Elements (EEs) and Focus ...
1
vote
1
answer
276
views
Advantages and disadvantages of including JS/CSS inside the HTML?
What are the advantages and disadvantages of including JS/CSS inside the HTML instead of separated files?
Specifically concerned about performance issues, for example, if the CSS and JS are small and ...
1
vote
2
answers
847
views
How to effectively handle a large API call
I have an API call that returns products to be displayed on a Point-of-Sale system. the current account I have has about 7000 products.
Initially I made the API return all products at once, this works ...
-1
votes
2
answers
210
views
Using OOP objects mapping to DOM elements vs. querying the DOM repeatedly?
I'm trying to make better use of OOP, but I don't have good instincts for this yet and I sometimes worry I'm making things more complicated and/or less efficient. I'm wondering what is the best way to ...
-3
votes
1
answer
83
views
Choosing between network optimisation and CPU usage in clientside web development [closed]
I'm working on a CSS library that includes hundreds of selectors and rules for quick templating instead of writing regular CSS.
This is used as a replacement of attr() CSS function until it works for ...
1
vote
1
answer
132
views
Feature Store Design for input data like JSON, CSV and Excel
I need a design approach for a feature store which accepts input data in the forms of CSV, EXCEL, JSON etc.
The backend stack we support is Java, Spring boot and oracle DB.
Note :
Each file ...
2
votes
2
answers
128
views
Design a function that indicates significant deviations in response times
I'd need some feedback on how to approach the design of a function that highlights parts of a time series chart. The chart shows the response time of an application, in particular the 90th percentile, ...
1
vote
2
answers
176
views
Automating performance tests for python code in a CI
My apologies in advance for a question that might seem trivial - I am a mostly solo dev in academic environment and a lot of industry best practices don't necessarily make it here.
Several of my ...
0
votes
1
answer
162
views
What approaches are there for handling elements in contiguous memory while being dependent on other user input
I am creating a vectorized reinforcement learning environment. It handles multiple instances of a board game in synchron. Up until now, the state of the environment was a specific representation of ...
2
votes
2
answers
1k
views
JS - two array filters vs. one forEach?
I've had a question for a while. I know that the Array prototype method filter is generally preferred over forEach, and I believe it is typically faster at the job as well.
But what about if I have ...
1
vote
1
answer
517
views
C++: Broadcast/observer pattern with polymorphic events
I'm currently trying to implement an event-system following a broadcast/observer scheme. I have events/notifications that contain information about what is happening:
class Event
{
public:
Event(...
-1
votes
1
answer
175
views
How to objectively monitor REST APIs performance based on the request/response size
We recently integrated a monitoring solution (Data Dog) for our REST-APIs based microservices. The monitoring solution gives us many useful metrics. For example, we can see the average response time ...
4
votes
1
answer
2k
views
In C++, If a member function can be made static with no change to functionality, are there any performance or memory benefits from doing so?
A very straightforward question.
When I think about many of the member functions I create for my classes, many of them can be made static without affecting any functionality whatsoever.
If I do so; ...
0
votes
0
answers
33
views
A large number unused wakelocks and performance
There is an application that every day creates about 100-200 new wakelocks for android. each wakelock is used once and after using it is no longer needed, but remains in the system. Thus there are a ...
1
vote
2
answers
665
views
Performance strategies for repeatedly iterating through large JSON files
I'm designing a project which will require iterating through a foreign language dictionary in JSON format. The idea is clicking on a word in a text will trigger a search on the JSON file for a match.
...
0
votes
1
answer
300
views
How to add APM/observability/tracing in a monolithic architecture?
I keep reading articles analyzing Monitoring and Observability, or having lots and lots of text regarding how the latter is the extension of the first, or how they are complementary, or how tracing is ...
1
vote
1
answer
108
views
How to segregate blog posts into seen and unseen?
Imagine an app like Instagram/Reddit with a feed of posts.
Problem: We want to show users posts they have not seen before.
When the user first opens the app, we retrieve 30 latest posts from the ...