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
6 views
Memory optimization when finding the Cartesian product in Python
My function gets the Cartesian product of a list of lists of tuples. The function is correctly producing the list of lists, but it's a memory hog (and leads to a MemoryError for large data sets, with ...
2
votes
0answers
10 views
URLEncoder implementation Round 2
Half an year ago I posted an implementation of a URL encoder for review. I didn't have any time to work on it until recently, but now looking at my old code with new eyes I saw how unreadable the code ...
2
votes
2answers
37 views
Python value comparing taking too long
Is there any way to make this code run faster. I have to compare values in a text file which is written in the format:
1 1.12345
2 0.12345
3 3.45678...
The values are in billions and the code ...
1
vote
0answers
22 views
Wrapper for GMP in C++
I'm writing a C++ high precision library based on GMP, sample code(files which have to be added to project):
...
4
votes
1answer
44 views
K-means algorithm very slow
I'm a beginner in Python but I have tried to implement K-means algorithm in python and it's working... but it's too slow... Instead of few seconds I can spend hours to finish it and I don't know why......
3
votes
0answers
46 views
Sorting almost sorted array with a minimum heap
I'm currently looking into the quickest way to sort an almost sorted array:
Given an array of \$n\$ elements, where each element is at most \$k\$ away
from its target position, devise an ...
2
votes
1answer
24 views
Fetch Keywords from comment and assign keyword id to comment
I have a small callback function which receives a comment in array like below:
...
2
votes
0answers
25 views
Generating an image with all 15-bit colors, each used exactly once
I've blatantly copied fejesjoco's solotion to this codegolf into Rust, and was hoping for some feedback.
Basically, it begins by generating a vector containing every possible 15-bit RGB color, and ...
-2
votes
2answers
49 views
-2
votes
1answer
29 views
Value passing for method parameters [on hold]
Let's say I have a method as follows:
public int getSum(int operandOne, int operandTwo) {
return operandOne + operandTwo;
}
So whenever I'm calling this ...
1
vote
0answers
20 views
Radix-2 FFT C code
I'm a beginner in C programming. I am current trying to work on a project requiring 1024-point FFT implementation using radix-2, Decimation-in-frequency. I attach the FFT function C code below. How ...
5
votes
0answers
285 views
Increase the speed of this python code for text processing
I need to iterate through a file of words and perform tests on them.
...
4
votes
2answers
38 views
Base object to convert positive numbers into other bases (2 <= base <= 35) in Python
I'm fairly new to Python (this is the first thing I've done that really takes advantage of classes). This works and I'm happy with it; just looking for general advice. Especially nice would be input ...
6
votes
0answers
47 views
Naive implementation of KMP algorithm
After reading this answer to the question "High execution time to count overlapping substrings", I decided to implement the suggested Knuth-Morris-Pratt (KMP) algorithm. I used the pseudo-code listed ...
7
votes
2answers
82 views
Fixed size dictionary to achieve performance goals
In my open source project, I have code that use a dictionary very intensively so system dictionary implementation did not suit me due to performance reason. Therefore, I decided to write my own ...
3
votes
0answers
16 views
Selecting indices of a cell array that strcmpi-match the contents of another cell array
I have a Matlab structure with several fields, 3 of which are interesting here:
...
3
votes
0answers
78 views
Thousands of GET requests for brute-force authentication attempts
I am applying a brute force to discover 123456 passwords in a given site (I am not going to say which one, of course).
The html gets a ...
5
votes
1answer
46 views
Increase performance of Bayesian likelihood equation
I need to calculate a Bayesian likelihood in its negative logarithmic form:
$$-\ln L = N\ln M -\sum\limits_{i=1}^{N} \ln\left\{P_i \sum\limits_{j=1}^M \frac{\exp\left[ -\frac{1}{2}\left(\sum_{k=1}^D \...
8
votes
3answers
85 views
Perf wrapper for Excel VBA
For a while now, I've been using this wrapper to avoid retyping most of it :
...
5
votes
0answers
37 views
Make To and From date range picker using jQuery UI
I implemented date range picker logic using jQUery UI datepicker component.
Here is my code:
...
1
vote
1answer
34 views
PagedList with large data sets
I'm using X.PagedList for paging functionality in my application. The code I have works fine but when I return larger sets of data it seems like it could be faster. Is there anything I can do to my ...
2
votes
1answer
24 views
Create several homogeneous arrays from a larger heterogenous array efficiently
I have a list of aircraft returned from a REST call which describes the status of each aircraft. In order to make the UI templating simpler, this single list is split into four homogeneous lists in ...
3
votes
1answer
42 views
Delete lines from a CSV file that contain fields listed in a text file
I wrote a powershell script to compare words from a text-file with a csv-column. If the word in the column matches, the line is deleted.
...
3
votes
0answers
49 views
Efficiently writing string comparison functions in Python
Let's say I work for a company that hands out different types of loans. We are getting our loan information from from a big data mart from which I need to calculate some additional things to calculate ...
4
votes
2answers
1k views
Hackerrank Submission Optimisation for Melodious Password
Given question from Hackerrank:
a password consists of exactly n lowercase English letters.
the password is melodious, meaning that consonants can only be next to
...
3
votes
0answers
36 views
Drawing a mask of the black pixels of an image [closed]
I'm drawing a pixel-by-pixel image with the following code
...
2
votes
1answer
67 views
Insertion and selection sort in PHP
I've implemented InsertionSort and SelectionSort in PHP and tested it with an array of 20.000 unique integers.
It took many seconds to complete the insertion selection sorts. For comparison, I saw a ...
6
votes
1answer
92 views
SkipList implementation in Java
The code works fine, but could likely be better. How can I improve it?
From Wikipedia:
A skip list is a data structure that allows fast search within an ordered sequence of elements. Fast search is ...
2
votes
0answers
45 views
Pushdown-stack: Test if a pop order is legal or not
I'm currently working through "Algorithms in java" by Robert Sedgewick (3rd edition, in german) on my own and am trying to solve one of the exercises there.
The exercise asks to develop and ...
7
votes
0answers
78 views
Simple game outcome simulator
I am trying to improve the performance of a monte carlo search algorithm that simulates random gameplays in a simple optimization game until a time limit is reached, and then returns the best outcome. ...
12
votes
5answers
557 views
Getting the dominant RGB color of a bitmap
I'm currently running this function 60 times per second in order to get the dominant color on my screen in RGB values. It is using approximately 15% of my CPU on 30FPS and 25% of my CPU on 60FPS. Is ...
3
votes
0answers
41 views
JavaScript copy paste cell values
The following function gets the lastly clicked cell value and pastes it into the edit box editBox, in which the user can then edit the value. Whenever the user goes ...
6
votes
1answer
81 views
Improving the performance of a webscraper
I have here a modified version of a web scraping code I wrote some weeks back. With some help from this forum, this modified version is faster (at 4secs per iteration) than the earlier version. ...
1
vote
0answers
38 views
RC4 implementation
I am using the following implementation of the RC4 encryption algorithm in C#
...
4
votes
0answers
39 views
Calculating parking and charging statistics for a car-sharing service
I am looking for help in designing my code more efficiently and also in keeping the slope of my personal learning curve steep:
For a research project I have per car data from two different car ...
4
votes
0answers
31 views
Counting weather events for visualization using Gnuplot
I wrote this code to analyze ~800 MB of weather data from the US. I am planning on visualizing the data with Gnuplot and Gimp. I have already made the images and a gif file. This code runs somewhat ...
1
vote
1answer
73 views
Finding prime numbers performance
I am writing an app that finds prime numbers within a specified range. Currently i am updating almost every part of the app and i have also changed the way i find prime numbers. The problem is that ...
6
votes
1answer
192 views
Calculator that works by compiling and running a .java file
I wrote this code for a simple calculator. It creates a java file from the term, compiles and executes it. Now my question is : Is there a better way of doing this ? Would it be more efficient to ...
8
votes
1answer
51 views
Sieve of Eratosthenes performance; Scala very slow compared to Node.js
I am new to Scala so it might show. I am learning it for one of my classes and have to write a performance benchmark. I have written the Sieve of Eratosthenes in both Node.js and Scala, and my Node.js ...
5
votes
2answers
101 views
7
votes
3answers
1k views
Leetcode 125. Valid Palindrome (better performance?)
Problem statement
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a ...
2
votes
0answers
32 views
Single-pass clustering algorithm for sparse matrices
I have written single pass clustering algo for reading sparse matrices passed from scikit tfidfvectoriser but the speed is king of average for medium size matrix. How can I scale for large size ...
-1
votes
1answer
90 views
C# greedy algorithm to pick activities that do not clash with each other
My task is the greedy algorithm:
The activity selection problem is characteristic to this class of problems, where the goal is to pick the maximum number of activities that do not clash with each ...
2
votes
0answers
18 views
Finding vtkCells in the vicinity of or coinciding with vtkPixels
I am looking to optimize this code. In its current state it is working, however, I am looking to improve it.
To represent the situation. I have a vtkPixel (...
9
votes
3answers
995 views
Finding the maximum element of a Stack
I have been solving this problem of Hackerrank recently .. https://www.hackerrank.com/challenges/maximum-element
A little bit about the problem
You have an empty sequence, and you will be given N ...
1
vote
1answer
42 views
VBA Macro to generate a report of mean values for each date
My Macro that I wrote is running really slowly and I'm not sure why. The Macro deletes the area, then reproduces one column of locations as a row, deleting any duplicates, then copy's across a column ...
5
votes
0answers
38 views
Android component animatable on its height
I'd like to have a code review for a component which is supposed to be animatable on its height. It's supposed to be a transitioning element.
I find it quite laggy on my phone.
...
7
votes
0answers
73 views
A port of a simple logger
I'm looking at porting a simple logger I wrote a while back in Python to a language which would result in less runtime overhead from logging.
As an informal benchmark, I try to log a message, ...
12
votes
2answers
127 views
Natural Order Comparator
I've been looking for an implementation of Comparator that provides a "natural order". I found a couple but they were buggy or poorly designed. I wrote my own with ...
1
vote
0answers
39 views
Snake game get lagspikes despite my optimization
Why is my code lagging? It gets those lagspikes that will ruin the whole game. I know JavaScript in the browser maybe isn't the best for games, but it doesn't have to lag?
...