1
vote
2answers
286 views
11
votes
3answers
804 views

Creating all possible combinations of points

I want to create all possible combinations of points (0,0),(0,1)...(12345,6789) and then all segments from these points. The code I have written is simple and with no optimization. Is there any ...
9
votes
3answers
291 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 ...
4
votes
1answer
41 views

Baseline tagger

This is a baseline tagger coed I have written. How can I optimize this code? ...
7
votes
3answers
102 views

Collect and calculate average times from log, then display top 10 longest durations

Here's a novel-length summary of the issue: I'm trying to write a VB.net program to help me collect remote site statistics from system-generated logs, but I'm a little like a carpenter who only knows ...
7
votes
2answers
212 views

Pulling JSON using jQuery and manipulating the Front-end

My JavaScript is fairly new and want to learn new ways to create clean, fast code. Can you have a look at this code and guide me on how to optimise this code to improve my skills? I have provided the ...
3
votes
3answers
182 views

Loop optimization for image processing

I have this piece of code that is running too slow. I was wondering if anyone can help me optimize it as I can't seem to find any more shortcuts. I'm not sure if using ...
1
vote
1answer
110 views

Efficiency of grid generated by for-in loop

I've spend the last several hours working on a loop designed to take items in an array and arrange them as a so to speak "gird" of ...
7
votes
1answer
319 views

Creating a thread for file transfer

I am creating an application in Java that runs at scheduled intervals and it transfer files from one server to another server. For SFTP I'm using ...
1
vote
2answers
123 views

How can I remove this for-loop in this competitive FizzBuzz code?

I'v written this code snippet that's part of a code competition. I want to do the trick without the for-loop, or simply find a way to optimize this code for speed. ...
2
votes
2answers
74 views

Optimizing Python code for Project Euler #5 (LCM of all numbers from 1 to 20)

This is my solution for the 5th problem of Project Euler, which asks for the least common multiples of the numbers from 1 to 20 (inclusive). Is there any way to improve the while loop conditional ...
4
votes
1answer
279 views

Optimize MySQL double select inside for-loop

I want to get the number if items with state 4 and 1 from my database for each day between a certain date. Is there a smarter ...
3
votes
2answers
101 views

7 for loops, 9 variables, 7 if statements, and one function

I have a large js function to calculate the number of chips, and which denomination of chips to show as the players chip stack. It's done on the base of 10. I have chip denominations worth 1, 10, ...
1
vote
1answer
73 views

Speeding up repetitive initialisation with structured data?

I need to speed up this code: it creates a multilinear function. I considered the below methods but no idea which with the largest benefit. replacing dummy variables with things such as anonymous ...
5
votes
1answer
100 views

Running a block of code on every interval except the first iteration

I am working with an encryption algorithm that looks like this The key is a number stored in 4 bytes. For each byte in the message, XOR it with the corresponding byte in the key When you reach the ...
20
votes
11answers
2k views

How to improve very loopy method?

I have a method that has a lot of loops: ...
2
votes
3answers
245 views

Improve nested loop for bio-statistics calculation

I am doing a bio-statistics calculation and the following code works. However, can someone help to improve the messy nested loop? ...
4
votes
5answers
264 views

Can I make this VB code run faster?

I need help making this code run faster. I am using it to import a CSV file into Excel. It works, but it is very slow. The file is almost 20MB. Any help is appreciated. ...
3
votes
1answer
139 views

Vectorize or otherwise speed up a double for loop

I have this function containing some loops and a double for loop. What it does is set up a matrix first to store results in (the task at hand is comparing genomes) and then with sliding window, ...
5
votes
2answers
852 views

Optimisations for this loop? (Garbage collection is slowing it down)

I'm working on a Game Of Life clone as my first project. I'm still relatively new to programming, so my code is probably not really optimised. The biggest bottleneck is in my Start() method, but that ...
4
votes
2answers
322 views

Optimizing if-statement with for-loop

I have been staring at this code for awhile now and I am thinking there is a way to optimize it (namely the if-else statement with the for-loops). Any advice would be greatly appreciated. ...
4
votes
3answers
285 views

Does this loop unrolling make sense?

I am coding a Hanning filter which is a recursive relation: y[i] = 0.25*(x[i] + 2*x[i-1] + x[i-2]) And here is my code were I attempt to unroll 3 times: ...
1
vote
2answers
100 views

Optimization of a while-loop searching for words in a dictionary

This is my first question here. I'm using an open source program called MElt which lemmatize (give the lemma example:giving-->give) of words. MElt works on Linux and its programmed in Perl and ...
0
votes
1answer
123 views

Avoiding dynamic RegEx creation in JavaScript

This function's job is to replace several text smilies, e.g. :D, :), :love with the ...
2
votes
1answer
148 views

Optimising If statement and for loops

I have two solutions (in jython) to take two pictures and copy and paste alternate sections of one picture to the other, like so: ...
1
vote
2answers
167 views

Optimizing Java code for setting color of specific keywords in a textview

I'm developing an Android app to view C-programs.I wanted to give a simple color scheme to the text which is stored in database,retrieved as string and then passed on to the textview. The code I ...
2
votes
1answer
120 views

Optimization expression evaluation chalange

It's my first message on this site. I'm trying to evaluate/learn C#. I'm an old (C++, MFC) programmer. I'm trying to learn C# with this little program(game) for my children. I'm trying to calculate ...
5
votes
4answers
950 views

Improve VBA code Excel

Im looking for someone who can improve my code, because at the moment it takes 4 minutes to execute. I'm new to VBA so it's probably bad coding. Normally if you are good in VBA you will understand the ...
4
votes
1answer
462 views

Looping through Radgrid in JS is slow, can this be faster?

I do a single select in one radgrid, and based upon that selection I want to select multiple rows in a different radgrid: ...
4
votes
1answer
240 views

Optimizing Python / Numpy Code

So I'm implementing a version of the mean shift image processing algorithm for color segmentation in python/numpy. I've written a pure numpy version of the actual mean shifting per pixel (which I ...
5
votes
1answer
140 views

How to speed up this following code

I am doing my research about scheduling by using Matlab. I am a new Matlab user and I have a problem with time execution of my following code: ...
4
votes
3answers
265 views

How to improve this method? (Create text without repetition)

The basic idea is not to allow the same texts and add +1 at the end. Imagine that I have a datagrid (wpf) with names, and every time I click the add button, I will put a new name on the list ...
1
vote
1answer
217 views

C arrays and loops optimization

I am writing a program for learning purposes that takes an input of a file structured similarly to: ...
5
votes
4answers
560 views

Improve speed for looping through 1,000's of items in javascript?

This is a script I use to count how many items are selected in a form. Currently it loops through the entire form to count how many check boxes are selected, each time a checkbox is clicked. The form ...
2
votes
1answer
775 views

filter a collection in a PagedCollectionView

I have scenario wherein I have to filter a collection in a PagedCollectionView. The filter criteria are Name and status which are check boxes with Enabled and Disabled labels If Enabled is checked it ...
3
votes
1answer
814 views

Code's optimization and speeding up (Legendre's polynomials and functions) in Matlab

I would like to improve this function to reduce the run time and optimize it. ...
2
votes
2answers
305 views

Java - Object declaration out of while loop

Could you explain to me which code is better (more optimal) and why? Vesion 1: ...
1
vote
3answers
664 views

Optimize Array.indexOf

How can I optimize checking a value in recursion before operating on it? I'm using Array.indexOf (this is Javascript) ...
5
votes
1answer
182 views

Determine which level of the text that it is currently parsing

So I have this code in my program, and there are multiple variations of it. Just looking at it, I feel like there must be a way to make it more efficient, but I can't think of anything. Just looking ...
3
votes
1answer
520 views

Nested while loop for getting db data. Timing out at random times because of the PHP. Any way to make this more efficient?

So today I jumbled together a script that would get data from a database, from different tables and such. I had wanted to just use simple ifs without the whiles, but I couldn't make it possible. The ...
2
votes
2answers
126 views

What do you think about this usage of for loop in JavaScript?

Algorithm that I had to write is a perfect case for while, or do..while loop, however I found out that if I will implement it with a for loop I will save few lines of code and also scope of variables ...
2
votes
3answers
3k views

reorder a list in java

I have three ways of reordering a list (think baseball order) and I am sure you can come up with more. What is a the best way? For example if input is list is 1,2,3,4 and current is 3 then the ...