Tagged Questions

Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.

learn more… | top users | synonyms (1)

4
votes
0answers
28 views

Simple micro-benchmarking library

I'm working on a simple micro-benchmarking library in Java. This library makes it easy to benchmark multiple reference implementations. You provide the inputs and trigger the calls, the library takes ...
2
votes
0answers
15 views

Find binary sequences with low peak sidelobe level of autocorrelation function

I would like to find all binary sequences from the specified range, which has low peak sidelobe level of its autocorrelation function. Here is solution (this is simplified version of the real code) ...
3
votes
2answers
48 views

Simplifying WebView

I started to code on Android, but I think my code is very heavy and may slow down the performance of my app. For example, when I run my app and I try to drag the page in one of my webviews, it's ...
2
votes
3answers
257 views

For a query over multiple databases, is it faster to do GROUP BY first or UNION first?

Having several databases with the same table, I need to group the union of the records. The xTables are stored in separate databases named by the year (this is by ...
4
votes
2answers
54 views

Fetch plist file

I have a plist file with many nested dictionaries inside of it, and I wanna fetch them all to my code. Isn't there any more efficient way to do that than nested for-loops? ...
2
votes
2answers
80 views

String compression using repeated character counts

Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become ...
4
votes
1answer
55 views

Function to run MySQL SELECT queries with no leaks

I am upgrading an old massive website that is a Classic ASP \ ASP.NET hybrid. I still have a long way to MVC. Right now I want to convert all code that uses ODBC to the mysql connector specific code. ...
3
votes
4answers
97 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 ...
9
votes
4answers
2k views

Brute force password cracker

I wrote this script for a proof of concept JavaScript password cracker: ...
2
votes
2answers
38 views

Changing IP of msloop

This changes the IP of msloop using WMI(Win32_NetworkAdapterConfiguration), which takes about 1~2sec. But, if I work on another computer, it works much much ...
6
votes
2answers
107 views

Generating 'Decent' numbers

While solving a problem from HackerRank, though it's aneasy one, I wrote this big program. Not sure if recursion is applicable and hold good but to me it looked like it isn't. However when I run the ...
0
votes
2answers
91 views

Increment a text field value

So let's take this code which increments a Javascript text field value: ...
4
votes
1answer
22 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: ...
8
votes
2answers
84 views

Optimizing String combinations in Java

I need to obtain all combinations of a String of length k from the given elements. For example, for ...
1
vote
1answer
36 views

Trajectory optimizations

Here's a function doing some trajectory optimization in the following manner: ...
1
vote
0answers
29 views

K-Means in Rust

I have implemented for learning purposes a simple K-Means clustering algorithm in Rust. For those who are not familiar: you are given N points, say in the plane, ...
4
votes
1answer
48 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 ...
25
votes
2answers
2k views

Quicksort implementation seems too slow with large data

I've written a program to compare different sorting algorithms with the array size being 10, 1,000, 100,000, 1,000,000 and 10,000,000. I, of course, expect Insertion to win out on 10 and merge heap ...
3
votes
2answers
74 views

Making this arraycopy more efficient

I'd like to find out how I can make my function more efficient: ...
4
votes
1answer
60 views

Fast regex to extract strings before and after a time

I want to get text1 and text2 by splitting time format Text1 10:24:02 Text2 Of the ...
2
votes
2answers
181 views

Comparing equivalent Scala and C# string-manipulation code - with Scala running much slower

I am very early in my journey of learning Scala, and I was doing challenges on hackerrank.com to get used to the syntax. As I finished one (very trivial) challenge, I noticed that the run times seem ...
3
votes
1answer
42 views

Calculating the distance squared between all vertex-pairs of a number of 2D polygons

I have implemented my code using Cython. It is the current bottleneck in my computations. There are two non-numpy functions involved: calculate_2D_dist_squared ...
11
votes
4answers
231 views

LW, MTD, STD, YTD Sales… all in line and looking pretty

That's Last Week, Month-to-Date, Season-to-Date, and Year-to-Date sales. I have a table-valued function for each one, that takes a date and returns all ...
0
votes
0answers
40 views

Linq to SQL ('select * from table').Count() vs (“select column from table”).Count() [migrated]

I am writing some linq queries where I came across following scenario: I want to fetch records from DB using Linq bases on some filter Here I want to take all record count also, so I did like ...
0
votes
0answers
23 views

App using JQueryMobile and Cordova

I have received a project that is built on Cordova with JQueryMobile. The app is already published on three platforms and is being used by 100K+ users. Now I have to add new functionality in it. But ...
9
votes
5answers
664 views

Find primes using “naive” algorithm

I know I can use Sieves to make this faster, but I wondered if there's anything I'm missing with this implementation of the "naive" algorithm. On my PC running the command (first million primes): ...
2
votes
1answer
44 views

CAPTCHA with images of objects

This CAPTCHA is not text but basically images of objects that the users has to identify between an array of options. My current code is kind-of slow because the query takes almost .7s to execute and ...
4
votes
4answers
299 views

Printing primes between user-given numbers

I want to display all the prime numbers between two integers taken from the user as input. Also I have to take a user input to specify the number of times the loop should run. Here is the Java code ...
2
votes
1answer
54 views

Perfect elimination ordering and high memory usage

The following code calculates a perfect elimination ordering in a special case in Haskell. I am less worried about its correctness than its high use of memory. The following code runs out of memory ...
0
votes
4answers
38 views

Speeding up script for processing three huge files

I have three huge files I need to process in order to rearrange the data contained within. The first file is a list of English example sentences (468,785 lines long). A typical line from this file ...
2
votes
2answers
69 views

Determining the next payment renewal date

I am not very good a JavaScript, surely not date manipulation, but I hacked together the script below with the purpose to determine the next payment renewal date based on a start date and payment ...
1
vote
1answer
86 views

Performance critical optimization routine with many arguments

A possibly similar question has been closed, but I'll give it a try anyway. A performance critical part of MATLAB code, a trajectory optimizer, has been moved to C (subroutine ...
1
vote
0answers
23 views

Optimise a spatial join for QGIS 2.0 Python plugin

I got a really great code review for a similar issue, but I seem to be unable to adapt it to another calculation for a QGIS 2.0 Python plugin. I am attaching field values to any features intersecting ...
3
votes
0answers
47 views

Finding the Cox regression coefficients in a mixed model for microarray data

I have written a code for a project which aims at finding the Cox regression coefficients in a mixed model for microarray data. The study was carried out on the Affymetrix Hgu133a platform. In the ...
6
votes
2answers
79 views

Parse floats from a string

While fixing some old code I came up with a class that parses floats from a string. This is used for parsing svg files in xml format. Floats can be separated by comma, space or anything at all in ...
3
votes
1answer
54 views

Implementing a linked list

I am studying data structures at the moment, so I want to see if there is anything wrong with my implementation of linked lists in C, after I checked Implementing an ArrayList. Header ...
2
votes
2answers
110 views

Improving the performance of Linq based solution

Again, out of fun on saturday night, I decided to solve the following problem from CodeEval. The challenge is finding the index of the lowest unique number. ...
2
votes
0answers
31 views

Speeding up this tfidf vectorizer

After thoroughly profiling my program, I have been able to pinpoint that it is being slowed down by the vectorizer. I am working on text data, and two lines of simple tfidf unigram vectorization is ...
1
vote
2answers
111 views

Project Euler #3 solution

I'm trying to solve Project Euler problem #3, which asks: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? Can you please review ...
3
votes
2answers
40 views

Extract last record inserted for each key identifier

I have a table with this schema ID, int primary key PathKey, string not null InsertDate, datetime not null Value, int not null In the table there are a ...
5
votes
1answer
84 views

Vector comparison inside for-loop

The following code finds no-rain periods in a time series that were preceded by rain over a threshold (e.g. 10mm in 2 days [k=48]). ...
7
votes
4answers
105 views

Forming output of lines based on input

I have homework, in which I get number of cases and then four numbers. Each number tells how many rows there are in each column For example: 2 2 3 3 should be ...
1
vote
2answers
76 views

Code to generate a dictionary from two lists

I created a script to perform a union on 2 lists: keys and words. I needed to create a dictionary from them. If there are more keys than words, missing words are replaced with "None". Any excess words ...
4
votes
2answers
149 views

“Utopian Tree” challenge optimization

Problem statement The Utopian tree goes through 2 cycles of growth every year. The first growth cycle occurs during the monsoon, when it doubles in height. The second growth cycle occurs during the ...
0
votes
2answers
19 views

Adding cells to a table

I'm calling the below 2 function once per Cell in a table with over 135 columns and over 200 rows (that is 134*200 = 26800 times, I'm not running the functions on ...
3
votes
3answers
111 views

Speeding up storage of about 220000 values in Core Data

I use this code on the app's first run to save about 220000 values into core data. The file Navaids.txt has about 200000 and Waypoints.txt has about 20000 lines, where I get data from each line and ...
3
votes
2answers
74 views

Finding the runtime of a task by name

Can this query be improved? I iterate over a couple of thousand times, and if I can improve it, it should decrease the run time. Otherwise I might look into using a batch instead of doing one at a ...
1
vote
2answers
105 views

Weekly fee calculation

I have the following query. Its execution took 15 min and it's too much slow. Is there a way to optimize it? ...
4
votes
1answer
72 views

Simple Cellular Automata (think Conway's Game of Life) simulator

Firstly, let me say that this code works, as posted. It fills a 10x10 grid with a random color (black/white) then runs a cellular automata simulation on the grid, starting or pausing when the button ...
1
vote
1answer
126 views

Speed optimization for girth-counting algorithm

I have the following girth-counting algorithm on a large 0-1 matrix and I need to optimize it for speed: ...