Questions tagged [optimization]

Optimization is the process of improving an existing program to make it work more efficiently or/and using less resources.

Filter by
Sorted by
Tagged with
1
vote
1answer
111 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 ...
0
votes
1answer
98 views

Worried about too many joins when fetching multiple datatypes in a single postgres query

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. ...
-3
votes
1answer
70 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
votes
1answer
70 views

How to optimize the request time for large data response?

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 ...
-2
votes
1answer
89 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 ...
-4
votes
1answer
60 views

Calculate math function depend on N value [closed]

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 = ...
-1
votes
1answer
73 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. # ...
-3
votes
1answer
114 views

Techniques I can use to optimise my C++ code further? [closed]

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 ...
0
votes
0answers
25 views

Why can't Django decide if preloading should be done through selecting or through prefetching?

In Django, one can select_related and prefetch_related. The former expands the DB query by extra fields and is used when there is at most one result ("parent" relationship, for example item....
-1
votes
1answer
36 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. ...
2
votes
0answers
65 views

Branch Prediction: How does a correlative branch predictor select from the global history?

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 ...
1
vote
4answers
206 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 ...
-1
votes
1answer
148 views

What kind of bin packing problem is this?

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 ...
0
votes
2answers
138 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 ...
26
votes
4answers
5k views

Do compilers optimise in concurrency?

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(...
-2
votes
1answer
96 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){ ...
4
votes
2answers
100 views

Separation of data retrieval and processing in loops?

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(...
1
vote
1answer
95 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 ...
0
votes
1answer
57 views

Need help with React Shape building app architecture

I am trying to figure out how to build most scalable and maintainable architecture for my app. The app is just about choosing some shape and then editing it. More precisely, choosing some existing ...
0
votes
2answers
194 views

Are lessons on tail recursion transferable to languages that don't optimize for it?

I'm currently reading through Structure and Interpretation of Computer Programs (SICP). During the course of that book, the lesson of "you can optimize recursive procedures by writing them as ...
-2
votes
3answers
162 views

Code optimization tool [closed]

Would it be possible to develop a program that could optimize algorithms, detect design patterns and then rewrite the code? For example: Detect a Bubble sort and transform it into a Quick sort or a ...
0
votes
3answers
148 views

Does the assembler perform the same tasks as the translator from C to assembly?

When compiling C programs to assembly programs and then to machine programs, does the assembler (e.g. the one used in GCC or other popular C compilers) perform the same tasks as the translator from C ...
-3
votes
2answers
70 views

Default assignment before if-elseIf or within if-elseIf-else , What is better in terms of performace/optimzation? [duplicate]

I have a piece of code where I need to assign a value to a variable, but base on condition, it could take other values. It can be done in multiple ways, but need to know which would be preferred in ...
-3
votes
1answer
171 views

Is it good practice to call service layer through domain object getters?

Tell me anybody, is it good practice to call service layer methods through domain object getters? Let me show you with an example: public class User { private long id; private String name; ...
-2
votes
1answer
72 views

Should graphql api implementation select specific fields from database before resolving?

I recently had to optimize my graphql API server by selecting only specific fields from the database before returning the actual result to the client. For example, let's say my graphql schema has the ...
0
votes
1answer
113 views

Microservices Conditional API Call Design

I always think about this scenario where we need to perform a task conditionally and the task requires calling another microservice. What I am not able to understand is which microservice's ...
4
votes
5answers
3k views

Is using 64 bit integers (long long) faster than less bits ones?

I read in the book "Game Engine Architecture" by Jason Gregory that: "It’s possible to access data items that are narrower than the width of a machine’s data bus, but it’s typically more costly than ...
-3
votes
2answers
39 views

Passing different sized parameters cost savings

I was wondering if there is some cost saving, either in time or space by passing and/or returning smaller arguments? char vs int. I have heard the compiler will optimize the code based on the type of ...
1
vote
1answer
44 views

How could I optimize an AJAX-based site by avoiding unnecessary/duplicate file-reads for each AJAX call?

I'm an IT guy (read: not a professional programmer) and have made an internal monitoring webtool which allows users to search for printers on our print servers. Based on the filtering criteria given, ...
0
votes
1answer
77 views

Transitive matching in streaming application

Problem A streaming application should perform matching transitively i.e. if A == B & B == C then A == C Current Implementation Application accepts domain objects in a streaming fashion and ...
3
votes
2answers
182 views

Does removing unused features from libraries through compiler flags increase or reduce security risks?

Software libraries targetting resource constrained environments like embedded systems use conditional compilation to allow consumers to shave space and thus increase performance by removing unused ...
7
votes
2answers
273 views

How does conditional compilation impact product quality, security and code complexity? [closed]

Software libraries targetting resource constrained environments like embedded systems use conditional compilation to allow consumers to shave space by removing unused features from the final binaries ...
-3
votes
2answers
71 views

How specific is hardware optimization when building from source/how do I know?

How specific is hardware optimization when building from source and what should I look for in the documentation to decide if building for my hardware might be worth it? From threads like this one I ...
-2
votes
1answer
60 views

Finding the domain(s) of variables in a Linear Program using the constraints? (Constraint programming/Linear programming)

Forgive my jargon , as I'm not very familiar with Constraint Satisfaction Problem(s) or Linear Programming procedures (For eg: Presolve) I have very trivial constraint set from variables of ...
-2
votes
1answer
81 views

Server-side vs. Client-side markup - whichi is more efficient?

The background of this question is stemming from an article about someone who operates a website that is powered by a solar panel and the carbon footprint that we produce in the software space. Data ...
7
votes
8answers
733 views

Relevance of optimization techniques

I've heard of some techniques to optimize code and make it faster: On one side are clearly relevant optimization: use of better algorithms, benchmarking, etc. On the other side are techniques with a ...
2
votes
4answers
445 views

Iterating through objects with slightly different interfaces

I am constructing modular logic for my object: separate pieces of functionality are going to separate modules. I will have the ability to connect and disconnect modules on demand. At some point my ...
5
votes
1answer
223 views

What is 'hand native' optimization?

In the seminal 1989 Microsoft memo Zero-defects code by Chris Mason (which is still a great read even today), the term 'hand native' is used several times. Some examples: 1. Users measure our ...
-2
votes
1answer
91 views

How to profile a program for performance without a profiler?

This is a general question but with a specific use case. There is only a single and completely unaffordable profiler for the Xamarin framework. So this makes me wonder if there are some programming ...
5
votes
6answers
4k views

Is there a way to speed up a big switch statement?

As a practice I'm working on a CPU simulator (runs at about 1.78MHz) and I'm using a switch statement to execute correct opcodes based on the value in the IR (instruction register) variable. This ...
0
votes
0answers
28 views

The optimal way to simulate vision detection from limited visual field

I need to build an experiment based on a scientific paper in which a high number of agents have a divided visual field (with limited detection distance) and have to detect other agents in a 2D ...
0
votes
1answer
155 views

Fuse 3D-Points in Bundle Adjustment?

I'm actually implementing my own Pose-Estimation/- and -Refinement pipeline. For this purpose I use one moving mono-camera. Then I take the consecutive images to estimate the pose and triangulate the ...
0
votes
2answers
123 views

Improve website speed with better user session management

I have an ecommerce website wherein as soon as a new user comes on website then a new visitorId gets generated for that user in database and that visitorId cookie gets stored in his browser and in ...
-1
votes
1answer
255 views

Do C# compilers optimize away the facade pattern?

In C#, if I hide away implementation behind a facade, or the "pimpl" pattern, does the compiler optimize away the intermediate function call if all it's doing is calling an equivalent method from ...
1
vote
2answers
244 views

Minimizing code duplication without using macros or sacrificing speed

Here's a snippet of code: An inlined function: inline void rayStep(const glm::vec3 &ray, float &rayLength, const glm::vec3 &distanceFactor, glm::ivec3 &currentVoxelCoordinates, const ...
2
votes
2answers
324 views

Memory optimization of public methods in java

Does it optimize a program in java to declare methods private wherever they can be private or it doesn't change a thing and it's just a question of encapsulation? I was asking myself if declaring a ...
8
votes
1answer
530 views

How can I optimize a program's performance when no profiling tools are available?

I am currently working on an OpenGl program whose performance I would like to improve. The performance is okay but not ideal on powerful dedicated GPUs, but is abysmal on integrated graphics (< 10 ...
2
votes
0answers
110 views

Implementing an iterator vs. looping over a list

I want to loop over a number of rows in a database and I have implemented an object in order to access the rows. Now when using this object I am not sure about the best practice. Implementing an ...
-2
votes
1answer
125 views

Sphere parameter optimization: how would I approach it? [closed]

I am looking to construct a program that takes, as input, 576 [x, y, z] points as well as 576 corresponding distance values. I want to find the [x, y, z, radius] parameters of a sphere such that the ...
2
votes
1answer
166 views

How can I optimize an alert system that processes 1000 requests / hour?

I am building a solution where IoT-devices send in measurement-data to an API that's hosted on AWS. For each measurement-type the user can set a threshold value; that when reached will trigger an ...

1
2 3 4 5
8