Tagged Questions

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
1answer
26 views

Drawing sets of boxes to display contents of arrays

This code draws two sets of 9 boxes on the screen to display the contents of two arrays. How can I speed up, shorten and make the code more efficient? ...
2
votes
1answer
33 views

Extracting a subgraph

Given a huge graph, I want to traverse it, in the fastest way possible, and extract a subgraph with the following properties: the starting node is specified the maximum number of elements and max ...
0
votes
0answers
13 views

Haskell Pure Fixed Length Queue

I am modeling an infectious disease with an fixed incubation period. I choose a queue to keep track of when people will become symptomatic. I imagined using some operations like so: ...
3
votes
3answers
54 views

PHP Bilingual Error System Ideas

I am building a php based mobile website that must be in both Spanish and English. This is my first bilingual site so I've been having to re-think a lot of coding practices I currently use to ...
2
votes
2answers
56 views

Transliterating Tatar To Cyrillic

Input : <h2>{translate} Dear Atteck {/translate} <br/></h2>{translate}Please complete registration</h5> {/translate} Output : ...
5
votes
1answer
42 views

VBA Code Profiling

I have wanted a way to do code profiling in VBA for quite some time. It becomes very complicated to figure out what methods are actually being executed for how long and how often in complex Access ...
0
votes
1answer
63 views

Streamlining a method to run faster

Update: I did some guesswork tweaking and let the heap reach a maximum of ~450 Megabytes (was originally using invokeAll). The program just finished in 6.3 minutes. I've been advised to use ctrl + ...
1
vote
2answers
26 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 ...
-1
votes
0answers
16 views

Example: Interfaces for adding data to a collection (readability, extensibility) [closed]

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
41 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 ...
1
vote
2answers
71 views

Normal distribution array function [closed]

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
49 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
16 views

Object doesn't support this property or method IE 8 Issue [closed]

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 ...
2
votes
0answers
80 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
189 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
175 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
28 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
61 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 ...
9
votes
1answer
88 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
47 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
67 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 ...
7
votes
3answers
130 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
80 views

Approximate integral in one line of code

This is what I came up with: Version 1: ...
0
votes
4answers
46 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
42 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
62 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
139 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
69 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
34 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
57 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
261 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
134 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

LINQ method to create objects of different types

I have the following code inside a method: ...
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
55 views
1
vote
1answer
95 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
136 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
57 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
26 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
592 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
110 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
178 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
67 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
60 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
245 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
74 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
73 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: ...