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.).
1
vote
1answer
11 views
How can this before/after jQuery hilighter be smaller?
I have a webpage that shows shorthand code on the left, and its long form on the right. When you hover over code on the left (signified with a space-separated array in the ...
0
votes
0answers
11 views
Example: Interfaces for adding data to a collection (readability, extensibility) [on hold]
I'm looking for some good practice advises regarding designing class interfaces where multiple methods should be provided to do a single task. As an example: Adding data to a collection.
Requirements
...
1
vote
2answers
30 views
Safety of globalizing config data
I have some framework in PHP/MySQL for developing web services. Finally my code works on two servers - production and developer. My idea is to create one code without differences, which will work ...
2
votes
2answers
82 views
Evaluating f(N,R)mod(m)
The goal is to find \$f(n,r)mod(m)\$ for the given values of \$n\$, \$r\$, \$m\$, where \$m\$ is a prime number.
\$f(n,r) = \dfrac{F(n)}{F(n-r) * F(r)}\$
where
\$F(n) = 1^1 * 2^2 * 3^3 *... * ...
1
vote
2answers
56 views
Normal distribution array function [on hold]
I have a function that produce an array with values that are Gaussian(normal) distribute. If you plot the values on a graph, it would look something like this:
Is there any way to improve on the ...
3
votes
1answer
45 views
Virtual Slots Implementation
What I can do to make this code more efficient?
It is supposed to be like one of those slot machines where you gamble on it and stuff (like at a casino).
...
0
votes
0answers
15 views
Object doesn't support this property or method IE 8 Issue [on hold]
Here is my code.
IE 8 results in an object doesn't support this property or method.
I'm using jQuery 1.11 and everything is defined in the head. Works great in all browsers except IE8
...
3
votes
1answer
46 views
Speed optimization for transparent gradient blend algorithm
The following algorithm works correctly for the purposes that I need, which is to set the top side of an image with a transparent gradient blend. Any tips to optimize it for speed?
...
2
votes
0answers
68 views
Function to replace color in .bmp
I wrote a function to replace color in a bitmap image. For beginners in image processing, it could be exclusively useful, since they could use it to replace the entire gamma of a color or to replace a ...
3
votes
3answers
178 views
Reading and printing sudoku input
I have seen programs to solve sudoku puzzles but to be honest.. They were badly written.
First of all, readability of the program itself was horrible and the code was really long and confusing.
So I ...
6
votes
2answers
171 views
Synchronous and asynchronous methods in a client library
I am working on a library in which I need to make synchronous and asynchronous method in my client library.
My library does this:
The customer will use our library and they will call it by passing ...
2
votes
1answer
26 views
Optimize calculation of string self-similarly with its suffixes
I am trying to solve a Hacker Rank problem about string suffixes:
For two strings A and B, we define the similarity of the strings to be
the length of the longest prefix common to both strings. ...
1
vote
2answers
56 views
A faster way to obtain multiple XML files from a server
I got this back ground console script running, which pulls all necessary XML files from the server, and stores them locally for faster performance. These XML files contain Graphs full of data, which ...
6
votes
3answers
557 views
Making this palindrome tester more efficient
This program takes lines of input. The first line is an int specifying how many further lines will be input. For the following lines (comprised of characters a-z), it will be determined whether ...
9
votes
1answer
74 views
Counting Words in Files - MATLAB style
Note: this question may seem quite large, but the code to review is actually quite short
For my Matlab class I'm taking, I was given the task to write a function ...
2
votes
2answers
44 views
Optimizing Sieve of Eratosthenes for larger numbers
I am having difficulty optimizing my code for the Sieve of Eratosthenes. The code works fine for smaller numbers (up to 10,000) but takes a long time to run for numbers over 100,000.
...
0
votes
1answer
59 views
Efficiently serialize big JSON using GSON without loading everything in memory?
Below is my JSON in which I have only three reportRecords just for demonstration purpose but in general sometimes we are getting pretty huge json, then it doesn't ...
0
votes
0answers
11 views
Newton Raphson for logistic regression [closed]
I did code for Newton Raphson for logistic regression. Unfortunately I tried many data there is no convergence. there is a mistake I do not know where is it. Can anyone help to figure out what is the ...
7
votes
3answers
124 views
Counting all pairs that differ by k
Given an array of numbers and another number k, how can I find the number of 2 elements such as their difference is equal to k?
...
0
votes
1answer
77 views
0
votes
4answers
42 views
Finding powers of multiple array pairs
I'm doing a challenge on TalentBuddy that requires you to find the powers of multiple array pairs. Since I got the solution right, but not fast enough, I decided I'd ask for help here.
...
1
vote
1answer
38 views
Using both setInterval and setTimeout for simple image carousel
I have a really basic image carousel that I just wrote.
Basically I'm trying to keep it as small and light weight as possible, but I get the feeling that I've gotten way off the beaten path of how ...
2
votes
1answer
60 views
Efficiently packing the header and data in one Byte Array in a single class
I have a header and data which I need to represent in one Byte Array. And I have a particular format for packing the header in a Byte Array and also a different format to pack the data in a Byte ...
8
votes
1answer
135 views
Speed, distance and time calculator
This is a speed distance and time calculator - the comments should explain most of the odd looking code if there is any. I am looking for suggestions to improve the efficiency of the program and how ...
4
votes
2answers
68 views
Custom sorting a list of objects efficiently
I'm trying to make sorting of objects in my program as fast as possible. I know that sorting with a cmp function is deprecated in python 3.x and that using keys is faster, but I'm not sure how to get ...
2
votes
1answer
30 views
Improving efficiency and flow by changing subroutine orders
A batch file executes WinSCP.exe's console mode to download files and log the actions. Upon exit, WinSCP returns:
ERRORLEVEL 0 if the files are successfully ...
0
votes
2answers
31 views
Django ListView with MySQL query for the queryset
(Note: Even if you don't know Django, it's probably the query that needs work anyway, so you probably don't need to know Django/Python)
I have a ListView that ...
3
votes
0answers
55 views
Grayscale bilinear patch extraction - SSE optimization
My program makes an intensive use of small sub-images extracted using bilinear interpolation from larger grayscale images (some call this problem subpixel translation).
I am using the following C++ ...
5
votes
2answers
259 views
Convert Roman to Int
I made a function that converts Roman letters to integers. But I'm not happy with it, as I feel like I used too much code for a such a simple task. Any suggestion on how I can minimize it?
...
3
votes
4answers
133 views
Faster Way of Comparing Generic Sets
The following extension method is the limiting factor in the performance of an application I am developing, according to Visual Studio 2012 Performance Analysis profiler.
Is there a faster way to ...
1
vote
1answer
69 views
2
votes
1answer
64 views
Speeding up the process of obtaining data
I created this script to obtain data from graphs online, from monavisaxmldata. But I were wondering if there was a way to obtain the data faster. The program which uses this data gets presented in a ...
-1
votes
1answer
53 views
1
vote
1answer
89 views
Utilization of Steam APIs and web-scraping
Some background info here:
This is a small fun project I made utilizing Steam APIs and web-scraping
This is the first time I've ever used Python, so I'm not very familiar with the language
I used ...
6
votes
2answers
131 views
Limited memory priority queue
I'm trying to implement a highly efficient limited memory priority queue. The interface is the same as a std::priority_queue.
Can anyone suggest any performance ...
3
votes
2answers
53 views
Hide / Show panels depending of value of a dropdown
According to the value of a dropdown menu I have to show/hide two panels.
For option 'derive' and 'reject' I should show the comment panel, and just for the 'derive' panel I should also show a ...
2
votes
0answers
25 views
Directions to refactor class for GPS track points
The story started here (Parsing GPS Data) and continued here (Class for median filter)
I've done a lot work and faced new questions.
In short - I made:
Classes for parsers. TrackParser and ...
6
votes
7answers
582 views
Project Euler #5 - Lowest Multiple of 1 through 20
I was trying to solve problem 5 of Project Euler, and this was I needed to do:
2520 is the smallest number that can be divided by each of the numbers
from 1 to 10 without any remainder.
...
0
votes
2answers
105 views
Increment a text field value
So let's take this code which increments a Javascript text field value:
...
4
votes
1answer
26 views
Grouping counts from tables by account ID
I'm working with this query to get counts from three different tables, and to group the results by account ID:
...
4
votes
1answer
86 views
Is a Number Prime?
Haven't posted here in a while, but I think I've come up with a very efficient way of finding if a number is prime, using TI-BASIC for use with TI-83/84/+/SE calculators. I am trying to optimize it ...
7
votes
2answers
167 views
Linked list implementation of a stack
I am working on a basic linked list implementation of a stack of ItemType (currently set to double but can be changed) values. The stack code will then be used in a ...
3
votes
1answer
66 views
Convert between two bases, each between 2 and 36
I'm doing some Python practice for fun and I wrote some code that converts between two bases. I'm thinking about expanding on this later, so the docstrings are pretty redundant from function to ...
3
votes
1answer
59 views
Improving efficiency of Prim's Algorithm
I have implemented Prim's Algorithm in Java. I am wondering how it can be made more efficient.
Below is the class Node for vertices.
...
5
votes
2answers
232 views
Draw crosshairs on the screen - ZedGraph
Here's some part of my code is use to draw objects on the screen :
Class members:
...
4
votes
1answer
71 views
Custom marquee consumes a lot of CPU power
I've a code which applies marquee to certain elements by using the requestAnimFrame method. However, when I test my application on a lower spec PC (Intel Celeron ...
2
votes
1answer
56 views
Defining functions in Vigenere cipher
I'm trying to learn the process of defining/calling a (somewhat) complex function.
I understand the main idea, and can do it on a small (simple) scale.
A simple example:
...
5
votes
4answers
218 views
Character permutations - Revisited
Several hours ago I posted this question about Generating character permutations in Python.
User rolfl said that my main problem was not using the right tool for the job, as Python is interpreted it ...
4
votes
1answer
46 views
Efficiency of looping though a text map to draw objects
I am making a game that uses a text map to draw obstacles and courses for the player to navigate. However, I am concerned that my method of looping through the text map to draw objects on the screen ...
4
votes
1answer
57 views
Speeding up nested for-loop analysis code
I have two matrices, the first one is mat 2000*500, the second one is 6000*500 ...