Optimization is the act of improving a method or design. In programming, 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)

2
votes
0answers
3 views

Stable custom alphabetical order using List<T>.Sort

Background This is a problem from a programming contest. The Sharonians of planet Sharon, at the far end of our galaxy, have discovered various samples of English text from our electronic ...
2
votes
0answers
10 views

Hiding and revealing toggle responds very slow

I have a list of 6 items, and each one on click reveals a div that runs 100% wide under the row of list items. The code works, but the div opens very slowly and kind of choppy. Is there anything I can ...
-2
votes
1answer
31 views

String handling [on hold]

I have small doubt which is the best way to handle string in below scenario: Am i creating too many instance of string is it right way to do in the loop ...
10
votes
1answer
500 views

Matrix multiplication

Below is the code that I've written for matrix multiplication: ...
4
votes
1answer
89 views

Is there a better way to assign two variable to two others conditionally?

I wrote this code, but it feels like it could be a bit more elegant: Relevant code only: ...
3
votes
0answers
60 views

How to copy files as fast as possible?

I am running my shell script on machineA which copies the files from machineB and machineC ...
3
votes
0answers
36 views

Navigation bar implementation

I made a navigation bar on the left side of my site. It works perfectly, the only problem is I'm new to jQuery and I think I'm repeating too much code. Is this the case? If it is please help me out. ...
3
votes
3answers
284 views

Bresenham's line algorithm implementation

May there be any performance and/or code standard improvements on the following LineOfSight code? ...
8
votes
6answers
336 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. ...
1
vote
0answers
16 views

Downloading and parsing list of Getcachine CWGs

I'm building a page that downloads list of Geocaching CWGs for my country in XML format and then parse it. The structure of the XML looks like this: ...
8
votes
3answers
242 views

Optimizing “Herd Sums” problem using dynamic programming

I'm trying to solve a practice problem and all is well except for the last 2 inputs my solution is too slow. Just one loop is slowing it down I think. Herd Sums Execution Time Limit: 2 ...
0
votes
0answers
9 views

How to optimize this loop by using dynamic programming [duplicate]

I'm trying to solve a practice problem and all is well except for the last 2 inputs my solution is too slow. Just one loop is slowing it down I think. Problem: Full Solution: ...
1
vote
3answers
69 views

Optimizing Project Euler 36 - double-base palindromes

This one was quick and simple. Any optimizations? ...
2
votes
1answer
34 views

Project Euler 35 in Python

I'm back with a Python solution for Project Euler 35. Any help would be appreciated; I generate the numbers by observing that all circular primes can only have digits 1, 3, 7, and 9. Then I use the ...
3
votes
0answers
43 views

Using CountDownLatch for blocking the reads if writes are happening

I am trying to implement lock by which I want to avoid reads from happening whenever I am doing a write on my three maps. Requirements: Reads block until all three maps have been set for the first ...
2
votes
1answer
87 views

Algorithm generating a unique ID based on client name

Following code is supposed generate a new ID (PID) for a new client based on the client name's first letter and the existing IDs in the range which are stored in a database. For ex lets say if the ...
2
votes
0answers
39 views

How to avoid reads before initialization is complete and return updated set of maps value?

I am trying to implement lock by which I want to avoid reads from happening whenever I am doing a write on my three maps. So my requirement is - Reads block until all three maps have been set for ...
6
votes
2answers
362 views

How to prevent reads before initialization is complete?

I am trying to implement lock by which I don't want to have reads from happening whenever I am doing a write. Below is my ClientData class in which I am using ...
11
votes
3answers
312 views

Text “analyzer” in C++

I have few years of experience with web and I recently started learning C++ and I feel a bit lost, so I would like to ask to for some tips how to improve my code overall. This text summarizer should ...
2
votes
2answers
70 views

Generating a random string of characters and symbols

After coding this, I was wondering if there are any ways in which I can improve upon it. It generates a random string of characters and symbols the same length as what is entered by the user. It uses ...
3
votes
0answers
49 views

Creating collisions for a breakout style wall

I am creating a breakout style game as an introduction to JavaScript, and would like to know whether the way I have gone about doing this is efficient/viable. As well as needing assistance with ...
4
votes
4answers
233 views

Optimizing system calls and nested loops

I'm writing a Perl program to take a set of clauses and a conclusion literal and produce a resolution-refutation proof (if possible) using a breadth-first set of support (SOS) search algorithm. The ...
5
votes
2answers
87 views

Keep asking the user [after performing an action] until they wish to stop

I have a form that requires the user to select photos to be included in their portfolio before they can proceed to use the app for the first time. I don't want to spend the rest of my life ...
5
votes
2answers
85 views

Optimizing simple xHTML parser

I'm writing a simple xHTML parser which parses a data without nested tags. Example input code will look like: ...
0
votes
1answer
66 views

How could I more optimize this code [closed]

how can I optimize this code more and more cleaned ok. Here is the code ...
10
votes
2answers
101 views

Optimize code to track player shot

This code is for a simple 2D tile-based game. x1 and y1 are the mouse coordinates in the world. ...
5
votes
1answer
63 views

Project Euler 34 - digit factorials

145 is a curious number, as \$1! + 4! + 5! = 1 + 24 + 120 = 145\$. Find the sum of all numbers which are equal to the sum of the factorial of their digits. Note: as \$1! = 1\$ and \$2! ...
7
votes
1answer
66 views

Project Euler Problem 33 - digit canceling fractions

Problem: The fraction \$(\dfrac{49}{98})\$ is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that \$(\dfrac{49}{98}) = ...
4
votes
1answer
42 views

Matrix rotation efficiency

I am not sure if I should be using recursion or not or if it even helps in increasing the performance of my algorithm. I feel as though I am creating and replacing too many arrays by calling my inner ...
2
votes
0answers
27 views

Parsing an infix notation expression and converting to reverse polish notation

I'm pretty new to Go, and I do not know the best or idiomatic ways to do most of the stuff, so I'd appreciate feedback on how to make my code better, faster or more idiomatic. My program is a set of ...
3
votes
1answer
106 views

Civilization 5 Mod validator part 2

Here is another portion of the same program that I would like optimizing (85-95% of the time running the program is spent within this class!!!) so that it runs faster, especially for users who have ...
1
vote
1answer
32 views

Adding additional function if condition is met

Here's my scenario: In case the table has class 'trans' - run dataTable() and ...
7
votes
1answer
52 views

Recording audio in C 2.0

I posted my audio recording program to Code Review before, and received a stern review along with the other reviews that caused me to rewrite the entire code base. Here is what I would like reviewed: ...
8
votes
1answer
109 views

Civilization 5 mod validator

I would like to submit a portion of my code for Code Review, and I have done my best to comment the code (and include essential parts that may aid understanding of the program) for your convenience! ...
4
votes
2answers
193 views

Reading a file and storing the contents in an array

This is my code for reading a file with a delimiter. Any suggestions to help improve my code efficiency? I am not satisfied with using array data structure. Can any other data structure be used ...
3
votes
1answer
45 views

Insertion Sort implementation in Java

I have implemented Insertion sort in Java. Please review it. ...
6
votes
4answers
537 views
1
vote
2answers
45 views

Any way to optimize this already fast Python solution to Project Euler 31 (coin sums)?

This is a Python solution for all general cases. Any suggestions at all would be appreciated; in my opinion it's already quite good! Here's a link to the problem. ...
4
votes
3answers
116 views

32-bit factorial calculator in x86 NASM assembly

This program calculates the factorial of a given positive number. This is how it handles input: if negative, terminate program if 0-2, display input without calculating if greater than or equal to ...
6
votes
1answer
43 views

Bash script to convert NIST vectors to debug scripts

TL;DR: The Bash script (below) is converting a published, somewhat-structured text file into a format usable by my testing infrastructure. It's slow, I think it's ugly -- although it is fully ...
4
votes
2answers
50 views

Page loader function

This is the function which I wrote and am currently using in my project. I want to know if there is a better way to write it: ...
7
votes
2answers
93 views

Detect optimized

I've been trying to optimize this piece of code: ...
4
votes
2answers
158 views

Optimization for histogram computation algorithm in C

Next is an algorithm to calculate the histogram for a given YUV420sp image. The YUV data is given by the hardware camera as an unsigned char*. The algorithms ...
5
votes
2answers
79 views

AutoComplete program using the n-gram model

For my Advanced Data Mining class (undergrad) we were to design a program that would predict the next word a user is likely to type via automatic text classification using the n-gram model. The ...
3
votes
0answers
21 views

sql indexing and performance [migrated]

I am using mysql5.1, i have table which has about 15 lakh (1.5 million) records.This table has records for different entities i.e child records for all master entities. There are 8 columns in this ...
3
votes
2answers
75 views

Is there a “prettier” way of forming this query, or a more efficient way of joining the tables?

Yesterday I posted a question involving multiple nested queries. The queries pulled information from the database and created a directory listing of all employees. There are two many-to-many ...
8
votes
1answer
167 views

Sprite drawing class

I have written a very XNA spritebatch like interface for drawing sprites in OpenGL. When begin is called the vertex data buffer is mapped to a float*. The index buffer and vertex buffer are bound in ...
0
votes
1answer
46 views

Would multiple joins boost performance, or are the nested queries an acceptable way to handle the situation?

I'm working on a directory that lists employee information. Each employee can belong to multiple departments and each employee can have multiple job titles. I have 5 ...
9
votes
4answers
323 views

Simplifying many-indents-code

I have the following code, written in Python: ...
7
votes
3answers
153 views

Checking to see whether a document can be deleted

My code looks like this: ...