Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.
1
vote
0answers
12 views
Sieve of Sundaram for Project Euler 7: Python implementation slower than C++ and R
A friend of mine recently started learning R, and she complained to me that R is very slow. She was working on Project Euler Problem 7, which asks for the value of the 10001st prime number. For ...
1
vote
1answer
25 views
Finding average word length in a given year
I have written a function which takes the year in question and words as a data which is a dictionary that maps words to the list of year/count. Now I am wondering how I can improve the code that I ...
1
vote
3answers
29 views
AudioMetaTagger: recursively read files and gather metadata
So the idea is to read metadata recursively in a chosen directory, load their metadata and display it into a table.
Here is the simplified example of what I am doing.
...
2
votes
1answer
24 views
Determine all prime, palindrome string integers within a range
I have written a program in Python 3x to determine all the prime, palindrome string integers in the range of two given numbers.
...
6
votes
2answers
321 views
The Bucketizer Script
This code is written in a SSIS Script Component that basically accomplishes what I previously had as a T-SQL script, that was reviewed here.
I need to split a 80 character string that contains 20 ...
3
votes
2answers
69 views
Twin Prime Algorithm Optimization
I have wrote the following algorithm to print out the Nth twin prime numbers:
...
4
votes
1answer
58 views
Speeding up Parallel.ForEach iterating through datatable and rendering report
I am attempting to speed up the processing of 5000 rows received from the database, which I then render as a crystal report, export to a byte stream and save in a database table.
Currently I am using ...
5
votes
3answers
100 views
Append a string to each line in a file
I wrote (several months ago) a program that will take an input file, with a provided std::string, and append that to each individual line in the file. Looking at ...
0
votes
1answer
86 views
Class for finding the median of a two-dimensional space
I have a simple static class that it's purpose is given an RDD of Point to find the median of each dimension and return that as a new ...
2
votes
0answers
14 views
Optimizing CouchDB reduce function
I have a CouchDB view with the following view/reduce function. After working over 2 hours on it, I have a result I am happy with, but I believe there is a lot of ...
4
votes
2answers
139 views
TapeEquilibrium implementation, performance issue
So, I took a test at Codility called TapeEquilibrium. The task description that I recieved can be seen here.
I came up with a solution that worked, and I was pretty happy with. However, the ...
2
votes
1answer
60 views
Loading the JDBC driver jar dynamically from external location
I have a small project in which I get the URL, username, password, and driver from a text file and I have to fire a query on the database by dynamically reading the jar file in a predefined directory, ...
-1
votes
1answer
39 views
1
vote
2answers
100 views
Octree code performance
I'm using a simple Octree in my program, wanted to know if my implementation could be faster. It is part of this program: https://github.com/Mortis69/rendera
Octree.H:
...
5
votes
1answer
51 views
Get all points on a uniform discrete grid inside a circle's radius
I have a 2-dimensional grid defined by a known point gridCenter and distance between points gridStep and need to find all points ...
2
votes
1answer
39 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
1answer
21 views
Increase performance of a spate of 2x2 matrix multiplication
I would like to improve the performance of the piece of code below (in Fortran). It gives good results but the profiling tells me that it is where it spends most of its running time.
Basically, it ...
0
votes
1answer
27 views
Improving excution time for list and sampling in Python
Here is my code for generating edge list based on Price model algorithm. I think there have two points to reduce execution time:
use proper data type
use faster random sampling
Originally, I used ...
3
votes
1answer
25 views
Merging predicted values into measured values
I created the following function below to merge the real values with the predicted values (when real are absent) in a new column in data.frame. The function ...
2
votes
1answer
33 views
GIF background rollover
I made a cool roll-over in CSS which displays an animated GIF when the parent is hovered.
Codepen
The problem is that I will have about 40 .day like that, all playing the animated GIF behind the ...
5
votes
1answer
103 views
Codility MaxCounters Peformance in Python capping out at 77% performance
My problem is quite similar to the question found here, except I am attempting to answer the question in Python.
Given an array of N counters, all initialized to 0, and an array ...
3
votes
3answers
51 views
Copy a directory from source to destination
I wrote a program that copies a directory from a source to a destination, similar to the cp utility.
For this, I used the essential functions:
...
5
votes
2answers
232 views
Reading, counting, and processing integers from a text file
The following code reads a .txt file that contain only numbers. Read the first one, create a dynamic array and put the other numbers on it, made some procedures and in the end write a file with the ...
3
votes
2answers
114 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) \cdot F(r)}$$
where
$$F(n) = 1^1 \cdot 2^2 \cdot ...
0
votes
1answer
60 views
4
votes
1answer
30 views
Remove sections of content from Quora.com
I wrote a Chrome browser extension to hide Top Content posts from Quora, which bother users following too few topics.
A user's feed in Quora.com starts as a list of posts relevant to the user, ...
3
votes
2answers
71 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?
...
4
votes
2answers
115 views
Algorithm for describing chess positions
I have an interesting problem with my chess application. The application reads PGN files, and at any time while viewing a game from the file, the function below, when called, iterates over the ...
2
votes
0answers
47 views
Dapper helper service
I've written a very light wrapper around dapper to help with unit testing and streamlining the dapper commands I need. Execute() is a method created to remove the ...
0
votes
0answers
39 views
Fastest computation of N likelihoods on normal distributions
In the context of a Gibbs sampler, I profiled my code and my major bottleneck is the following:
I need to compute the likelihood of N points assuming they have been drawn from N normal distributions ...
1
vote
2answers
117 views
Sieve of Erathosthenes speedup
While reading HackerNews, I learned about a data set of the first 50 million primes. This would be a lot, but his website has disclaimer:
n this directory I have the first fifty million primes in ...
9
votes
1answer
94 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 ...
1
vote
1answer
48 views
Search layout with 2 edittext and 2 buttons
I'm building an Android app and I'm new on building the UI on an .xml file. I've built a simple layout but I think that is not optimize very well.
This component is a search layout with 2 edittext ...
4
votes
2answers
217 views
Scaling jsTree performance
I am using jsTree v1.0 (latest v3.0, they withdraw support from older versions) to display the hierarchy in my application. It was good until until I started showing groups/user up to 200 levels, but ...
3
votes
1answer
89 views
PermCheck Codility with time complexity of O(N)
I have this solution for Codility's PermCheck problem. In summary, the task is to check whether array A contains each number in \$1 \ldots N\$ exactly once.
I got ...
1
vote
1answer
53 views
2
votes
2answers
76 views
Computing pairwise bitwise OR in a list of bit-strings
I am trying to solve this problem using Clojure:
You are given a list of \$N\$ people who are attending ACM-ICPC World
Finals. Each of them are either well versed in a topic or they are
not. ...
3
votes
2answers
253 views
4x4 Sudoku solver performance
The code is for a 4x4 Sudoku solver. It works fine when there are a small number of unfilled spaces (0's) but when I give the whole matrix input as 0's or so the solver takes a very long time. I need ...
4
votes
4answers
50 views
Optimise runtime of filter character method
I'm trying to run the method below against a very large corpus and I need to optimize/reduce the run time for this method as it already takes up about 6 seconds to execute.
Requirements:
Check the ...
10
votes
1answer
107 views
Gray codes addition
As some of you know, I have been working with Gray codes and am trying to design a good gray_code class in modern C++. I will end up posting several parts of the ...
7
votes
3answers
131 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?
...
5
votes
2answers
324 views
Shell sort seems inefficient
I am testing various sorting algorithms. Right now I am testing shell sort, insertion sort and selection sort. I ran all three algorithms on a randomly-generated list of 1000 integers. The selection ...
1
vote
0answers
48 views
Optimize QuadTree to find K Nearest Neighbors
I'm looking a way to make my k nearest neighbors search more efficient. The context of the question is that I'm given a list of topics that have a unique ID (integer) and a (x,y) coordinate (floats) ...
4
votes
2answers
71 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 ...
7
votes
1answer
65 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 ...
12
votes
1answer
197 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
61 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 ...
3
votes
3answers
292 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
73 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
103 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
...