Questions related to improving application performance.
-2
votes
0answers
19 views
Snake game in C [on hold]
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <conio.h>
#include<time.h>
#include<ctype.h>
#include <time.h>
#include <windows.h>
...
5
votes
2answers
368 views
How can I make this brute force faster?
Code no longer relevant but I want to know how I can make it faster. It use only about 10% of my CPU. Any advice about best practices, better algorithms, or how to make the existing one faster are ...
4
votes
2answers
84 views
Optimization of file scanner
Program must to find duplicate files (by content) in a given directory(and subdirectories).
I collect all data in Map<Long, ArrayList<String>> map where Key is the size of file and Value ...
3
votes
1answer
63 views
Speed up file format conversion
I wrote this quick script to convert a genotype file into a BED file. Running it seems to be taking a very long time.
#BED file format
#http://genome.ucsc.edu/FAQ/FAQformat.html#format1
#1.chrom - ...
5
votes
2answers
133 views
Relevant performance difference C#-VB.NET - Integer Division
C# code
static int KEY_NOT_FOUND = -1;
private void Form1_Load(object sender, EventArgs e)
{
int[] A = createArray(1, 100000);
Stopwatch sw1 = performCalcs(1, A);
Stopwatch sw2 = ...
15
votes
7answers
2k views
Using a for-loop instead of sleeping? [on hold]
In C, using sleep() would make the program wait for a short interval of time:
sleep(2000); //or whatever the number (in milliseconds)
But I really don't want to include unistd.h just to use sleep, ...
4
votes
4answers
88 views
Save space occupied by 2D array
My goal is to save space occupied by 2D array (sea) that has 3 different values.
Ocean sea; //Ocean class has member 'private int[][] oceanMatrix;'
public final static int EMPTY = 1;
public final ...
4
votes
3answers
103 views
Compute bounding rectangle given 2 points quickly and efficiently
Is there a faster way to compute the bounding area between 2 points?
// Minified Version
public static Rectangle computeBounds(Point2D.Double p1, Point2D.Double p2) {
double dx = p2.x - p1.x, dy ...
4
votes
2answers
227 views
Performing non-production analytics on data
I have the following Lua script which I use against my redis environment to perform some non-production analytics on my data.
My dataset contains hundreds of millions of records, hence I want to make ...
1
vote
2answers
33 views
C++ memset / memcpy / strcpy implementation performance
In C++, I have made a basic memset / memcpy / strcpy implementation, yet I am worried that they are slower than the STL equivalent, as they are probably made in assembly, which I do not know. Is there ...
9
votes
2answers
82 views
Improve performance of math function applied to arrays
This block of code is already somewhat optimized thanks to some answers given over at Stack Overflow. In the last question I made (Improve performance of function without parallelization) the code was ...
3
votes
1answer
33 views
Counter in FASM assembly
I am making a simple counter in assembly. It counts to a billion and exits. However, the performance of this is really horrible. A Java application (that does the same) outperforms it by around 10x. ...
6
votes
2answers
161 views
Performance of collision detection in a grid
I have fairly simple collision checking and handling Python code which is currently bottlenecking my performance quite a bit. I haven't done too much coding in python and I'm quite sure there's ...
2
votes
0answers
24 views
Benchmarking PHP requests [closed]
I am using Apache ab to test one simple file and Zend application.
Zend application page is default page that comes with skeleton application.
And another file is show below:
$start = ...
1
vote
0answers
65 views
Entity Framework 6.0.2 - Performance of Auditable Change Tracking Part 2 of 2
This is Part 2 of a question about performance and general best practices. Part 1 is located here. The body of the messages are the same to illustrate their similarity, the difference is the code ...
4
votes
2answers
118 views
Retrieve and load playlists from YouTube
I have this code I am using in a private project. The following is a snippet of code I use to retrieve and load playlists from YouTube:
for (feedEntry in a.feed.entry) {
if ...
3
votes
1answer
106 views
Entity Framework 6.0.2 - Performance of Auditable Change Tracking Part 1 of 2
This is Part 1 of a question about performance and general best practices. Part 2 is located here. The body of the messages are the same to illustrate their similarity, the difference is the code ...
7
votes
1answer
76 views
Faster way to find maximum deviation?
So, it was a part of my coding challenge and the last one, but I failed because it failed to yield a result in two seconds for some of sample inputs (out of six samples, three passed but three failed ...
8
votes
2answers
84 views
Can this secure, random generator be improved?
This random generator uses cryptographically secure numbers/chars instead of Math.random(). The Javascript code with jQuery works well but I affect clean code ;) It would be great if you could help me ...
6
votes
2answers
73 views
Fast edit of Excel file
I have this code to edit certain cells in my Excel file using Apache POI, but it is really slow. How can I improved the performance?
Ideally I would like to edit 20000 rows in less than one minute. ...
1
vote
2answers
28 views
Range Minimum Query Implementation in Scala
I would like to heat some feedback on this. I'm coming from a Java background and this is my first program in Scala. I solved Range Minimum Query problem.
object Solution {
def main(args: ...
7
votes
1answer
94 views
Measuring a method executing time
I have been playing around with some improvements to some sort algorithms like Selection Sort and Merge Sort and I ended up needing some sort of measurement to check if my versions were any faster ...
7
votes
3answers
189 views
Sieve of Erathostenes optimization
I am making a program to find primes between the given range of numbers. Unfortunately, the algorithm I created is too slow. Do you have any ideas of how to optimize the code?
import java.io.*;
...
5
votes
3answers
126 views
Code optimization for SQLite result set parsing
I am retrieving information from an SQLite database that gives me back around 20 million rows that I need to process. This information is then transformed into a dict of lists which I need to use. I ...
8
votes
1answer
58 views
Help speeding up my first Bash script
This is my first more-than-1-line script. It takes an inputfolder and a file prefix and get all the files matching. For the first of the files, the script grabs the first line and appends an extra ...
3
votes
1answer
60 views
Is duplicate testing preferred over a call that would usually be moot?
To test incoming data for string values that are too large for the "database" (MS Access), I could do this:
private void SaveToMSAccess(InventoryItem invItem, string dbContext)
{
invItem = ...
4
votes
1answer
57 views
Fastest Way to Write Multiple CSV's
I'm writing a program to process log files. Currently, I have a script that will extract the desired information from each log and put it into a list - I have about nine different lists all ...
7
votes
3answers
564 views
Shortest path algorithm is too slow [closed]
I am solving one problem with shortest path algorithm, but it is too slow.
The problem is that I have N points and these can be connected only if the distance between them is smaller or equal than ...
4
votes
1answer
125 views
Why does this python code take so long?
I don't understand what is taking the program so long:
#!/bin/python
primes=[]
i=0
j=0
k=0
for i in range(2,2000000): #fill in the list
primes.append(i)
i=0
while i<len(primes):
...
6
votes
4answers
147 views
Most efficient way to populate a vector of integers with no duplicates
I am trying to populate a vector of integers with one billion random number. The only constraint is that there can be no duplicates in the array.
#include <iostream>
#include <algorithm>
...
1
vote
1answer
52 views
Which iMacros script is faster?
test1.js
var macro;
macro ="CODE:";
macro +="URL GOTO=http://tppcrpg.net/map.php?Map=11\n";
macro +="TAG POS=1 TYPE=INPUT:IMAGE FORM=ACTION:/map.php?Map=11 ATTR=NAME:Find";
iimPlay(macro);
...
1
vote
0answers
10 views
Why is this Fizz Buzz generator significantly faster than this Fizz Buzz Iterator class? [migrated]
After learning about iterator class methods and generators, I tested the performance characteristics of simple Fizz Buzz solutions utilizing each idiom:
>>> from timeit import timeit
...
6
votes
2answers
67 views
Draw the table like 6³ = 3³ + 4³ + 5³ to 100³ = 35³ + 70³ + 85³
I want to draw the table like this:
6³ = 3³ + 4³ + 5³
9³ = 1³ + 6³ + 8³
12³ = 6³ + 8³ + 10³
18³ = 2³ + 12³ + 16³
18³ = 9³ + 12³ + 15³
19³ = 3³ + 10³ + 18³
20³ = 7³ + 14³ + 17³
.....
100³ = 35³ + 70³ ...
7
votes
2answers
535 views
Fastest way to cut an array into two arrays at a particular index
Suppose I have the array:
double[] arrayToCut = new double[100];
for(int i = 0 ; i < 100 ; ++i) {
arrayToCut[i] = Math.random();
}
My objective is to end up with two arrays, firstArray and ...
6
votes
1answer
68 views
How to make my memcpy implementation fast?
I have tried to write a function like memcpy. It copies sizeof(long) bytes at a time.
What surprised me is how inefficient it is, it's just 17% more efficient than the naivest implementation with ...
9
votes
2answers
203 views
Linked list arithmetic
I am practicing for interviews and I tried solving the problem on my own and got a solution. I was wondering how can I improve the performance and memory on this program?
The problem performs ...
7
votes
1answer
73 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 jSch, and my server and file details came from ...
6
votes
1answer
100 views
Faster computation of barycentric coordinates for many points
I'm just starting to understand the Python syntax and I created a module that does what I wanted, but really slow.
Here are the stats of cProfile, top 10 ordered by internal time:
ncalls tottime ...
1
vote
1answer
108 views
Making adding to a dictionary more efficient?
I have the following code and it's taking quite some time to run. I'm getting an Out of Memory Exception due to the high volume of answers there are. Is there any way I could speed it up?
var ...
6
votes
2answers
83 views
Simplifying this form validation script
Can anyone please help me to simplify this form validation script? It works great but I was just wondering if I can get some help to make it simpler. Your opinion on the approach I used below is ...
-1
votes
3answers
70 views
Optimization of code on continuous array values [closed]
This is my complete code and also I have added logic from Simons answer here selected rows should be 0,1,2,4,5,7,8 but with logic provided by Simon its not working. please suggest over logic in catch ...
7
votes
1answer
69 views
Function launching default editor
I have written a function that launches the default editor set in git config, right now I have managed to get it working for Sublime, nano and Vim.
def launchEditor(editor):
""" this function ...
5
votes
3answers
101 views
Class with a temporary buffer: Tradeoff between memory usage and execution speed
Consider the following two classes
class foo{
// huge data structure - 400-500 bytes per instance
};
class Bar{
void get_foo(int n, foo& f);
}
In my application I need to work with N ...
3
votes
1answer
81 views
Speedups for Conway's Game of Life
I wrote Conway's Game of Life in Python with Pyglet. It works pretty well but is very slow when the number of cells gets high. Any easier speedups I can attain with this code?
import pyglet
import ...
2
votes
1answer
98 views
Find password to a word document
I am using Java and COM4j to communicate with Word. The approach I used here is brute force. I have a password protected .doc, and I forgot its password.
Complexity is (26)(maxPassLength). [a-z ...
3
votes
1answer
168 views
Why is my web scraping script so slow?
My script, which is a web scraping script, is very slow, I even needed to put set_time_limit(0);
This is the whole http://phpfiddle.org/main/code/9qt-78n
I think the problem is here:
foreach ...
7
votes
5answers
125 views
Reading from text file with RegexMatch
Below is the method that I have written for reading from a text file. While reading, I need to match line string to given regex and if it matches then I need to add the line string to a collection.
...
6
votes
3answers
212 views
How can I improve the performance of this concurrent http request loop?
I'm using the rolling curl library to fire http requests for content-length headers of images (we need to know their size to weed out placeholders and low res images). The image urls are stored in a ...
2
votes
2answers
103 views
Improve performance while Traversing List
I was trying to write a Java program to compare previous records while traversing. It returns true if element exists previously, else false.
e.g.
if elements are {"Raj","Jas","Kam","Jas"} then ...
0
votes
0answers
8 views
How many Angular Controllers and/or Directives is too many? [migrated]
I'm building a large, editable data table with angular, and I'm trying to figure out what the best practice is.
The table will be a couple of hundred rows, with a couple of dozen columns, so upwards ...