Skip to main content

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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
34 views

The reason I wanted to ask is because of some code from Undertale that is responsible for choosing which dialogue set to use. It works something like this: switch (id) { case 0: msg[0] = &...
Bunabyte's user avatar
  • 651
13 votes
5 answers
3k views

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 ...
Arseni Mourzenko's user avatar
-4 votes
3 answers
256 views

I have written a parser for Transfer-Encoding: chunked requests over HTTP/1.1. Now I'm working on optimizing the code. This is the specification 7.1. Chunked Transfer Coding. The first optimization ...
guest271314's user avatar
1 vote
1 answer
157 views

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 ...
Ammar's user avatar
  • 123
10 votes
7 answers
4k views

I'm writing a program that works with directed acyclic graphs and performs rewriting operations on them. Sometimes the graphs are small, sometimes they can be very large and grow as the program ...
Foxy's user avatar
  • 621
3 votes
3 answers
641 views

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 ...
jokoon's user avatar
  • 2,280
0 votes
0 answers
66 views

I'm trying to model a metal treatment process to improve its efficiency. We have 11 different components that all have to flow through the same process, but each component spends a different amount of ...
user448889's user avatar
0 votes
4 answers
209 views

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 ...
Devsman's user avatar
  • 601
0 votes
0 answers
122 views

It's been a long time that I had an idea of a semantic constraint as compiler optimizations which allows for sophisticated high level optimization allowing you to transform the AST/CFG based on a SFG (...
C5H8NNaO4's user avatar
  • 129
0 votes
3 answers
199 views

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 ...
pschill's user avatar
  • 2,040
-2 votes
2 answers
303 views

Prelude Recently, I helped a friend of mine in coding him a problem for his university Algorithms course, where problems are submitted in Java. I sent him code with good O notation complexity, ...
blonded04's user avatar
  • 105
0 votes
0 answers
52 views

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 ...
Samuel's user avatar
  • 799
0 votes
1 answer
171 views

If a lambda is frequently used, it is considered to reuse the same instance instead of creating new instances repeatedly. How can I minimize the number of captured variables in lambda expressions?
Arunabh's user avatar
15 votes
4 answers
5k views

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 ...
Jeremy Fisher's user avatar
25 votes
10 answers
10k views

If you have an OO language, where every object always has a copy method, shouldn't that be deep copy by default? In most languages I know, such a copy method is shallow, since a shallow copy is more ...
Mecki's user avatar
  • 2,390
0 votes
1 answer
600 views

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 ...
b3rry's user avatar
  • 3
3 votes
1 answer
509 views

In relation to another question I had, I have been researching Simulated Annealing. The general example used with this algorithm is the traveling salesman example. I have been testing the code ...
wforl's user avatar
  • 159
2 votes
2 answers
411 views

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 ...
Dario.Casciato's user avatar
0 votes
1 answer
178 views

Reading this interesting paper it seems that a lot of performance loss is due to scheduling overhead in tight loops. To recap: There's a variable called "Chunksize" which determines how big ...
glades's user avatar
  • 493
8 votes
3 answers
270 views

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-...
Da Spud Lord's user avatar
1 vote
2 answers
494 views

Python is one of the few languages to support a string data type of code points (Unicode Scalar Values). I'm also wanting to creating a language that has this same characteristic, but I need to ...
Hydroper's user avatar
  • 121
7 votes
4 answers
3k views

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, ...
L'Animal Fou's user avatar
-1 votes
1 answer
192 views

I'm using flask with SQLAlchemy on a postgresql database for a mobile app I'm building. My application allows a single user to save lets say up to 5 different locations which are saved in the database....
joepaji's user avatar
0 votes
1 answer
180 views

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 ...
lampshade's user avatar
  • 103
0 votes
3 answers
3k views

I have built a string to enum converter, which converts a known set of strings that it receives into enum, in order to satisfy a function pointer. Some of you may recognize some elements of this ...
HFOrangefish's user avatar
0 votes
1 answer
621 views

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 ...
Ahmed Sadman Muhib's user avatar
0 votes
1 answer
128 views

Given: You have a list of opportunities* that may improve the speed metrics of your website. For example Total Blocking Time (TBT) is one metric that heavily impacts the experience of a visitor. You'...
Jeremy Gottfried's user avatar
0 votes
3 answers
4k views

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 ...
gandalf113's user avatar
-1 votes
2 answers
282 views

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 ...
Component 10's user avatar
0 votes
0 answers
57 views

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 ...
Freshman's Dream's user avatar
0 votes
0 answers
49 views

My restraints are that I have to use: Django and MongoDB I am trying to build a website that will read some JSON input and then parse all the properties and objects in the JSON and display results. ...
xf900's user avatar
  • 1
3 votes
1 answer
2k views

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, ...
nanotek's user avatar
  • 341
0 votes
1 answer
203 views

I'm mostly interested in C and C++, but I think this question can also apply to other languages. My question is, if an unamed object or value is generated from the evaluation of an expression or ...
SingleQuestion's user avatar
1 vote
1 answer
2k views

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 ...
Day Trip's user avatar
0 votes
1 answer
267 views

Its not exactly my use case (would take too long too explain), but imagine a task management application where tasks for employees are displayed in a list along with some information about that task. ...
user2741831's user avatar
-3 votes
1 answer
107 views

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 ...
Tot's user avatar
  • 147
-1 votes
1 answer
2k views

I have created a dashboard for rendering a list of clients into a DataTable. Below shown is the data model structure: When I had a few records in the clients schema, let's say a thousand rows, the ...
Saud's user avatar
  • 109
-2 votes
1 answer
395 views

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 ...
Cornwell's user avatar
  • 117
-4 votes
1 answer
78 views

I have method with the following prototype : R[] = method(k,n) which : n = ordinal value 0 <n <10^9 k = math function depend on n value : i.e n^6 R = array of computed values For example : n = ...
whiteRice's user avatar
-1 votes
1 answer
94 views

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. # ...
Ulysses's user avatar
  • 101
-3 votes
1 answer
238 views

I'm working on loading PNG files. I know there are existing libraries, but I'm doing this for learning purposes. Previously, I was using LodePNG, which is a great library that performs really well. I ...
NeomerArcana's user avatar
-1 votes
1 answer
46 views

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. ...
Ayman's user avatar
  • 1
2 votes
0 answers
173 views

I am trying to understand how branch prediction works, specifically with regards to correlative branch prediction. I understand that in an (m, n) branch predictor, there are m branch predictors, with ...
Adam Lee's user avatar
  • 129
1 vote
4 answers
319 views

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 ...
Moritz Groß's user avatar
-1 votes
1 answer
213 views

I have a problem formulation but it does not resemble the usual packing problem I find in the literature but it is a usual problem in the packing industry. I just do not know the name for it. The ...
David Zanger's user avatar
0 votes
2 answers
243 views

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 ...
DrDress's user avatar
  • 127
26 votes
4 answers
6k views

Presuming that I have written some sequential code where it can be broken down into multiple isolated tasks, it seems it might be efficient for concurrency to be introduced. For example print(...
Ben's user avatar
  • 369
-2 votes
1 answer
592 views

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){ ...
ShayakSarkar's user avatar
4 votes
2 answers
169 views

Often I need to get some data and process it in some way. For example getting a list of customers from an API and assemble some summary data on them. As an example, getting : api_result = api.request(...
User's user avatar
  • 1,581
2 votes
1 answer
243 views

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 ...
Lance Pollard's user avatar

1
2 3 4 5
9