Questions tagged [optimization]
Optimization is the process of improving an existing program to make it work more efficiently or/and using less resources. Remember this site is only for conceptual questions, so please ask only conceptual ones about optimization. If you want your specific code to get optimized, better ask the question on StackOverflow or CodeReview.SE.
406 questions
13
votes
5
answers
2k
views
How do I find what's causing a task to be slow, when CPU, memory, disk and network are not used at 100%?
I'm currently analyzing a process that is considered too slow.
In summary, it's a task that loads a lot of data from Microsoft SQL Server, performs some basic stuff on it, and creates a report. It ...
1
vote
1
answer
152
views
Optimal way to match prioritized list of tasks with available workers
Problem
Match prioritized tasks with suitable workers.
Details
Consider a task with following properties - type and size. Based on task type, tasks are prioritized.
While a worker has following ...
3
votes
3
answers
629
views
How can single thread execution speed further increase since frequency stagnates?
What are things that newer CPU can do to speed up single thread execution?
multiple registers? (can compilers always benefit from it?)
SIMD? (do compilers use SIMD without code annotation?)
does a ...
0
votes
4
answers
209
views
Should a null block be used for semantic purposes?
I was writing a procedure that is only applicable in a particular case, but it didn't feel right to enforce it by contract or raising exceptions, because there's no problem with calling it in other ...
0
votes
3
answers
197
views
Optimize reservation system algorithm
Im am developing a logistics application and at the moment, I try to solve the following problem:
In the system, there are multiple machines.
Each machine has one or more skills. For example, machine ...
0
votes
0
answers
51
views
Designing an optimization on throughput of EF.Core application
I am looking for feedback on a design problem I encountered when processing batches of db entries. The issue at hand is efficiency and throughput of an application.
The application looks like this ...
15
votes
4
answers
5k
views
Better solutions than joining table for Many to Many?
Lets say I have students and classes which are 2 entities. A student can take many classes and a class can have many students. This would be a many to many relationship.
To solve this with an RDBMS my ...
0
votes
1
answer
595
views
How do function inlining and Tail Call Optimization affect call stack?
I've just accidentally came across this answer about inlined functions and I'd like to know how this affects call stack. But I can't add comments because I don't have enough rep so I decided to ask ...
2
votes
2
answers
407
views
Optimizing Flash Memory Writes in Embedded Systems with Unpredictable Power Loss
I'm working on an embedded C++ project that involves logging certain types of statistical data (like successful accesses, failed attempts, and other events) to the flash memory (just incrementing ...
8
votes
3
answers
270
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-...
7
votes
4
answers
3k
views
Is it better to iterate over data once and do multiple complex operations, or to iterate multiple times with simpler operations?
Here I'm working in Python, but it's more of a language agnostic question, unless specific language features makes it clear that an option is better than the other.
I get my raw data from a REST API, ...
0
votes
1
answer
180
views
Is it premature optimisation to test a condition to skip a small loop?
I have an array of entities which have an id property:
entities: {id: string|null}[] = [];
All items in the array are guaranteed to have id !== null and the array will not exceed 100 items.
Now I may ...
0
votes
1
answer
619
views
How to optimize average rating calculation in a review system?
I'm thinking of a designing a review system (restaurant, hotel etc) where users can drop star reviews. Typically in a such a application, you can see the average rating of an entity along with all ...
0
votes
3
answers
4k
views
Optimal method of storing image thumbnails
I'm working on an application with a database containing many recipes. The API is written in Django (with Django REST Framework) and frontend in React.Each recipe is assigned a high-quality image. In ...
0
votes
0
answers
57
views
Feasibility of Delievery App
In my town, recently a delivery company has been opened (think DoorDash but on a much smaller scale and only doing local deliveries).
Now what really confuses me is that they charge pennies for each ...
3
votes
1
answer
2k
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, ...
1
vote
1
answer
2k
views
How to remove unused code from a jar file? [closed]
I have a jar file, for example foo.jar. My code contains a lot of libraries (almost 75 jar dependencies). I am not using anything like maven or gradle, I'm just using pure java with pure jar files as ...
-3
votes
1
answer
106
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 ...
-2
votes
1
answer
394
views
Recommended way of caching weather information
I'm developing an application that will show some weather information based on the user's location. Since the weather forecast is just a very small feature of the app that complements the main ones, I ...
-1
votes
1
answer
94
views
In a language interpreted line by line - is optimizing similar lines of code within a module into functions better in terms of efficiency? [duplicate]
While writing python code (I write python-selenium for GUI automation), I am facing situations wheer I have to deal with 5 widgets that do the same thing, just there xpath is differs by one term.
# ...
-1
votes
1
answer
46
views
how to model this relation by linear constraints?
v = |x1-x2| with 0<=xj<=C for j=1,2, C constant
I was trying to moel this relation by linear constraints. This is what I've done
equality is equivalente to superior and inferior relation.
...
1
vote
4
answers
319
views
Software-design for algorithm engineering
I'm currently working on an program that solves a graph optimization problem.
I know the "standard" software-design principles like information hiding, modularization, etc. What I'm ...
0
votes
2
answers
243
views
Drawing all lines from right to left - fast
I have several drawings from SVG files which basically contain basic outlines of figures. They are constructed in segments of various shapes (lines, ellipse arcs, Bezier curves ect.) Something like ...
-2
votes
1
answer
588
views
How to manually delete a std::vector in c++? [closed]
I have following code snippet
void func(int row,int n,std::vector<int>& buffer){
if(row>n){
return;
}
std::vector<int> new_buffer;
for(int elm : buffer){
...
2
votes
1
answer
242
views
How to play sounds optimally in the browser?
I have a new site that allows you to play sounds of letters on click. Each letter produces a separate sound. I went from roughly 500kb for .wav files to around 30kb for each sound file. That's a lot ...