Optimization is the act of improving a method or design. Optimization usually takes the form of improving the efficiency of an algorithm, or reducing the resources it requires (space in memory, on disk, or amount of network traffic, etc.).

learn more… | top users | synonyms (2)

0
votes
0answers
69 views
+50

Having full atomicity against all the threads without impacting performance or throughputs

I am working on a project in which I construct a URL with a valid hostname (but not a blocked hostname) and then execute that URL using RestTemplate from my main ...
5
votes
1answer
53 views

Producing the intersection of several sequences

Based on this SO answer I have created a method that produce the set intersection of several sequences: ...
6
votes
2answers
182 views

How can I quickly find unique list items?

I use the loop-every-single-list-item approach to filter out unique elements in a given list, which tends to be very inefficient way as a list grow in size, or as function call frequency increases. ...
0
votes
3answers
72 views

Generating rooms in a map

I'm working on a game in JavaScript and I'm trying to generate rooms in a map. For this example, the map is 32 by 24 (each tile is 32 by 32 pixels). A room is made up of a collection of tiles. A ...
6
votes
1answer
42 views

Implementation of Tower of Hanoi iterative procedure

I have been working last night on implementing Tower of Hanoi without using recursion. I have found an algorithm on Wikipedia about the same topic here. I have implemented it and it's working fine ...
1
vote
1answer
56 views

Spreading the load more evenly from a background thread

I have a background thread which runs every 5 minutes. I am using ScheduledExecutorService for this. Every five minutes, I am making a call to one of my service and ...
0
votes
0answers
25 views

How to serialize data from two URL's in the same object efficiently?

This is a follow on to: Serializing JSON data coming from two URLs in the same object I have two URLs (urlA and urlB) and both ...
2
votes
0answers
23 views

Careful simulation of a 3D space [on hold]

What is an accurate computer-description of space? I've been building up my abilities with various population simulations, and I'd like to add a spacial element to them now. I'm self-taught with ...
3
votes
0answers
50 views

Making loop in CSS Stylus more efficient

I'm not sure if this could be more efficient because I don't think I should need 2 keyframe loops in addition to the for loop? ...
2
votes
1answer
61 views

Interview task to efficiently find compact representation of nodes in tree and find big O time

I recently had an interview problem where I was asked to find a compact representation of nodes in a tree. As an example, consider the following tree: ...
1
vote
2answers
54 views

Filtering by value X from array Y with a fallback

I wrote a function that solve a special problem. But one of my 'special hardcore software engineers' told me that this is a bad solution - but he will not give me a better solution. So I ask you: What ...
4
votes
2answers
34 views

Batch file-download script - is it necessary to re-phrase commands?

I run a script to download a file and unzip it. An import process then runs and leaves the files in their source location. I wrote the fully functioning code below to clean up that directory to be ...
1
vote
0answers
23 views

Efficient C Code Alternative to MATLAB's im2col

The function im2col in MATLAB is very useful to vectorize Patch based Image Processing algorithms. The problem is the function isn't optimized and doesn't use C ...
1
vote
1answer
36 views

Optimization of Hibernate DAO in desktop application

I'm working on medium sized desktop application (with around 100 tables in database). For persistence layer I decided to use Hibernate for the first time to avoid massive redundancy of code for ...
3
votes
0answers
21 views

jQuery cycle content of static HTML page

I am making a simple jQuery code that changes the content of a static HTML page when a button (previous/next aka left/right) are pressed. The page is static, so the content that must be cycled (images ...
3
votes
4answers
298 views

Need help to optimise my C# code

I have a section of my code that seems to take a while during processing. Basically rawArray contains ~1.5 million rows and ...
1
vote
1answer
57 views

Large arrays make runtime very slow

So I have the following code that takes the input of two arrays, and apply some queries to match elements from DBpediaClassesArray with elements from ...
4
votes
2answers
60 views

Is this the optimal way to write “find these IDs in a list of objects” using linq?

I've got a situation where I have a list of Organizations (code to follow), and a user has a list of OrganizationIds (ints). I ...
11
votes
2answers
213 views

Why is my Neural Network so slow?

I have some neural network Julia code which I'm hoping to speed up. It's possibly simply poorly-designed, but I'm not convinced. ...
2
votes
2answers
51 views

Optimizing a particle filter weighted selection step

I have a vector with 10000 particles that I use in a Particle Filter. The problem is that it's taking too long to compute the weighted selection of the particles. I want to use a vector of weights ...
11
votes
1answer
223 views
+50

My final sign up controller

I've asked a couple of questions here before regarding my controller, but I think I've finally gotten to understand controllers completely, but I'll never be sure unless I get my code reviewed. I've ...
-1
votes
0answers
15 views

Windows forms begins to hang and freeze, how can I make this code efficient? [on hold]

I'm using a function that checks if a Site is Online or Offline, my problem is since I have more than 10 sites that are being checked for availability it begins to lag my application. This is the code ...
10
votes
3answers
223 views

How can I make my solution for Chef and Digits run faster?

Problem Statement Given \$n\$ digits and \$m\$ indices \$x\$ from \$1. \ldots,n\$, calculate the difference \$b_y = a_x - a_y\$ for all indices \$y \; (y < x)\$. Then, calculate \$B1\$, ...
4
votes
1answer
655 views

Hackerrank Gem Stones

I am working on some problems on Hackerrank. John has discovered various rocks. Each rock is composed of various elements, and each element is represented by a lowercase Latin letter from 'a' to ...
2
votes
2answers
73 views

Optimizing nested “Select Distinct” query

I am using the following query which is causing issues. Note following points: I am using 4 tables in this query: message_share ...
0
votes
0answers
48 views

Checking a value before assigning it to variable

Throughout my code, I find myself testing if the output of a function is undefined or blank before i use the output. In this case, getQuery checks if the property of an object is either blank or if ...
2
votes
1answer
157 views

Recording options selected from dropdown menu

I am hoping someone can help me attain better performance and better ways of writing this script. Any help would be awesome! Overall Goal: I have a dropdown that allows someone to select an option ...
1
vote
1answer
92 views

Optimizing a social network website

I am developing my social network website, and I want to know if it's optimized or not. I am good at ASP.NET 4 and WebForms, but not MVC or JavaScript. This code is for "liking" a post. I did not ...
6
votes
1answer
78 views

Check a collection of prices against an associated collection of minimum prices

I would like to find a more efficient way to solve this problem. My current implementation has 3 separate loops through the data. I'm creating an algorithm to check a collection of prices against an ...
3
votes
1answer
48 views

Inserting data in 3 tables of a database with JPA

I am starting a personal project and my first step is to insert a lot of statuses from tweeter in a database along with it's user and place (if applicable). This is the database structure: Pretty ...
6
votes
1answer
690 views

Optimizing solution for Project Euler Problem #23 (non-abundant sums)

Project Euler Problem 23 asks: A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be ...
16
votes
4answers
1k views

Recording audio in C

This is a program I wrote as a .wav audio recording library for Linux. It was developed on a Raspberry Pi, so that may affect the dependencies required.(1) Here ...
2
votes
1answer
51 views

Tail recursive sort

I've heard of this implementation of quick sort (in pseudocode): ...
5
votes
3answers
148 views

Project Euler #9 - Pythagorean triplets

This code works, and I'm trying to figure out if there's a better way to optimize it. As you can see, I've cut down drastically on time just by using numbers that work for ...
5
votes
1answer
64 views

Fast string formatting in for loop

I have a function that loops through large objects of raw data, translating coded strings into readable words. The function is very basic, and I keep wondering if I should use an object instead ...
6
votes
2answers
262 views

Pinging a URL with libcurl

I've asked a question about pinging a URL before, but I wanted something that was a bit shorter and still just as efficient. libcurl seemed to be the perfect answer. Here is my method: ...
8
votes
2answers
225 views

Serializing JSON data coming from two URLs in the same object

I have two URLs (urlA and urlB) and both the URL gives me a JSON response back in the same JSON format. Below is my JSON string ...
5
votes
1answer
41 views

File validator configured using XML

I am making an application to check for any files that does not follow a specific pattern defined in a XML file. The application works well, but the source code is not the greatest, and memory ...
0
votes
1answer
35 views

Optimize setting parameters from query string

I am currently setting over a hundred global variables by performing individual checks against the URL string. ...
14
votes
4answers
437 views

Finding person with most medals in Olympics database

I have an Olympics database from each Olympic year and I want to find the person that has won the most medals. The main problem is that I'm basically querying the same sub-query twice in ...
9
votes
6answers
458 views

Approximating the square root using an iterative method

I wrote this code, based on the Newton-Raphson method, to find the square root of a number. I'm wondering how I can optimise this code, as I am out of ideas. ...
6
votes
1answer
217 views

Python class that implements the Newton method

Here is a python function I wrote to implement the Newton method for optimization for the case where you are trying to optimize a function that takes a vector input and gives a scalar output. I use ...
10
votes
1answer
420 views

Factoring quadratic equation

I have a program I am writing that calculates Algebra 2 functions and equations. The interface is all CLI, and I even made commands that are similar to shell commands. That's not the part I want ...
11
votes
5answers
1k views

Dynamic programming with Fibonacci

I have written the following code using a dynamic programming technique. Can I use ArrayList here? Please let me know if I can improve this code. ...
8
votes
6answers
856 views

Is it possible to optimize the following boolean checks?

The following code works and it prints out only True as it is supposed to, for all the different cases: ...
6
votes
1answer
110 views

Reducing memory footprint of ReportViewer

We have implemented a process using C# and ReportViewer to create PDFs by the LocalReport.Render method. When we have to process ...
4
votes
2answers
114 views

Reverse Game HackerRank Ruby Solution

Problem Statement Akash and Akhil are playing a game. They have N balls numbered from 0 to N−1. Akhil asks Akash to reverse the position of the balls, i.e., to change the order ...
18
votes
5answers
9k views

Better way to generate all combinations?

I'm generating all combinations of an array, so for instance, ["a", "b", "c", "d"] will generate: ...
6
votes
5answers
968 views

String traversal program in C

My task was to write a function in C where a string such as {2210090,34566,87234,564676} would be given as input and the function had to find out the count of ...
0
votes
1answer
34 views

Ruby Optimize Performance

I'm trying to do the Reverse Groups Challenge on Codeeval. My logic is function but when I try to submit my solution is says that timed out at 10 seconds. How can I improve the speed here? ...