Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.
3
votes
1answer
22 views
3
votes
4answers
68 views
Efficiently concatenate substrings of long list of strings
I am having performance problems with the following python function:
...
3
votes
0answers
30 views
Web scraping from the Google Play store
I am using this R function to web scrape data from the google play store. Is there a way to increase its efficiency using R? This code takes about 4 seconds for 14 urls with my machine/internet ...
5
votes
0answers
84 views
JSON parser in C#
I've writen a C# JSON parser, but its performance is not as good as JSON.NET.
Running the same test, my parser takes 278 ms and JSON.NET takes 24 ms. What should I do to optimize it? It seems that ...
7
votes
2answers
242 views
Efficient URL Escape (Percent-Encoding)
Here I have a simple algorithm to percent-encode any string.
(Specification from Wikipedia; note that this is not compatible with URLEncoder.encode())
Is this an ...
12
votes
5answers
968 views
Finding the 10001st prime
I'm solving Project Euler problem 7, which says:
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number?
Here's the ...
10
votes
2answers
59 views
Roguelike-ish template game
I have created a simple program that is supposed to be the core of a roguelike game. The program uses ncurses, and all that is supposed to happen is you choose a race and class, then choose an arena. ...
6
votes
1answer
92 views
Random String Generation - Base36 and optimization
This is some fairly heavily optimized C#. Aside from reading like C++ code due to all of the pointers, does this pass sanity checks, and is there any way to improve it, while keeping its speed (or ...
1
vote
0answers
20 views
SQL Query Count Records and Pull Distinct
So I need a little help. It is currently working but I might have over complicated it. So maybe someone has a better idea. Now let me try and explain it.
I am trying this query, and it currently ...
3
votes
1answer
74 views
Function to rebalance portfolio
I wrote a small code in Python to conduct a backtest. My 'rebalance' function is very slow and I would like to improve it. I need to profile it but I would welcome any opinion on how to refactor my ...
2
votes
3answers
65 views
Showing the path of a projectile
I'm trying to dive deeper into C#, and so I've been experimenting with some code. I'm creating a console application that shows the path of a projectile depending on the angle, and it works great! You ...
1
vote
0answers
29 views
Archiving an SQL table of sessions and statistics
What my query is doing:
I have two SQL tables and I want to copy datarows from the one table to the other table. I am doing this for statistics. The source table includes all current ...
2
votes
4answers
72 views
Sending templatized e-mail to a million contacts
This code runs fine without a bug, I need to optimize this code for following interview requirement.
Lets say i need to send it to 1 million contacts and emailBody is ~100Kb.
What code optimization ...
4
votes
1answer
72 views
Generating frequency tables based on CSV dataset, in R
As a follow-up to this question concerning Python I present you with the exact same thing - for R.
Initially I started with R. However, it takes 44 minutes to run when unleashed on all my data. I ...
4
votes
1answer
53 views
Generic vector implementation in C using macros
I while ago I experimented with macros in C and came up with the idea of implementing a generic vector library using macros.
This code uses the non standard typeof ...
4
votes
1answer
39 views
Adding/changing ID3 tags to media files with “artist - title” format
This code puts or changes ID3 tags to media files based on their file names. It assumes the files are in this format:
morbid angel - maze of torment.mp3
The ...
4
votes
2answers
202 views
Manipulating each value in a 2D array
This code is about manipulating each value in a 2D array. My method below is called based on how I want the values in the array to be manipulated (process).
For the first method in the switch ...
4
votes
2answers
145 views
Generating frequency tables based on CSV dataset
I am working on a project which crunches plain text files (.lst).
The name of the file names (fileName) are important because ...
4
votes
1answer
100 views
Performance Byte[] to Generic
I'm in need to make a byte[] -> T extension method and need it to be fast (no need for it being pretty)
This function will be ...
4
votes
1answer
24 views
Gives a live view to a changing file on server
I have a file on my server which contains a running output of a script. This file is constantly changing and fluctuates in size between 0 - 1Mb. Now I want to take this file and make it viewable from ...
1
vote
1answer
40 views
Looking within a directory for a file
I have written this code to build a list by looking inside directory within deep to the level it finds a audio file and then move to the next level or next folder.
Can there be a more efficient way ...
4
votes
1answer
40 views
Optimising script that does simple renaming of files
I have recently written some code in Bash where I'm starting to program some things and I think I'm overcomplicating the script I wrote.
I'd like to make it simpler so that in future I would avoid ...
7
votes
1answer
44 views
Slick Lags when drawing 800+ circles
I am making a space-themed shooter game, and I need to render many "lasers" at the same time. I am using the library Slick2D, a wrapper around ...
7
votes
2answers
49 views
Long running time on VBA macro which filters and splits dataset into new workbooks
The VBA macro below uses a worksheet (source_data_worksheet) to filter and split out the records based on about a dozen unique column (D) values in a dataset of about to separate workbooks which are ...
5
votes
1answer
63 views
Matching between files and a list of filenames at scale
Given a folder typically containing ~250,000 small (20-100kb) files in HTML format (they open as single-sheet workbooks in Excel) and a list of ~ 1 million filenames, I need to open all the files that ...
0
votes
0answers
46 views
Integrating depth images into an SDF
I want to improve the following peace of code as much as possible, both regarding to speed and other aspects I may not know about. Since I have learned C++ myself, there are probably many things to ...
3
votes
3answers
209 views
Unit Converter in Python
I am new to programming and I am trying to make a simple unit converter in python. I want to convert units within the metric system and metric to imperial and vice-versa. I have started with this code ...
5
votes
2answers
113 views
Java Implementation of Sieve of Eratosthenes algorithm
I previously asked about my implementation of the Sieve of Eratosthenes algorithm here.
After looking at all of the feedback, I have reworked the code to make it significantly more efficient. ...
-2
votes
0answers
51 views
Optimize CSV reader
This code takes more than 5 days running, but, it worked perfectly on the data test.
...
1
vote
1answer
29 views
Implementation of Euclidean algorithm
I have made an implementation of the Euclidean algorithm in Java, following the pseudocode shown below.
As far as my knowledge goes, I can't find a way of making this more efficient.
I have looked ...
7
votes
2answers
78 views
Series sum calculator
This is my program currently to calculate sum of following series:
$$\frac{x^2}{2!} + \frac{x^4}{4!} + \frac{x^6}{6!} \dots$$
...
5
votes
1answer
65 views
Parse OpenFoam files in Python
I'm writing a Python parser for OpenFoam mesh files. When the mesh is big, I face performance issues.
Here is the format of the file describing the points:
...
5
votes
4answers
186 views
Finding the most common character in a string with a hash map
I created a method for finding the most common character in a string (using HashMap):
...
5
votes
2answers
54 views
Terrain height map generator
I wrote a Perl script that implements the algorithm described in this
article to generate terrain height maps. The idea is to raise a random hill \$i\$ of size \$r_i\$ centered at point \$(x_i, ...
2
votes
0answers
40 views
Efficient Sets and Maps with Treaps
I wrote up a Treap implementation to serve as the base class for a bunch of augmented data structures (interval sets, plane (2D) sets, order statistic trees), replacing my RB-tree base.
Some ...
4
votes
3answers
52 views
Writing huge 2D vectors to text file too slow
I have 10 large (34 million cell) 2D gridded vectors storing doubles. When written they are over 200 MB in size. I use an ofstream object to write them to a text ...
7
votes
2answers
65 views
Minimum number of coins problem using dynamic programming - follow up
I previously posted a code here. It turns out that the code is not following the correct dynamic programming principles and instead it was based on a greedy approach. Hence, I started again, keeping ...
4
votes
0answers
132 views
Stored Procedure code shortening and optimization
This stored procedure takes user defined table type as parameter. It contains data imported from an Excel file. Values inside that type are the same as in ...
10
votes
3answers
565 views
Coin Change: Minimum number of coins
Problem:
You are given n types of coin denominations of values \$v(1) < v(2) < ... < v(n)\$ (all integers). Assume \$v(1) = 1\$, so you can always make change for any amount of money ...
2
votes
0answers
43 views
Optimization with a lower value constraint for positive solutions
Let \$D\$ be a \$N\times N\$ positive definite matrix. I am minimizing a quadratic funtion
$$ f(w)=w^T D\ w$$
with respect to the weight vector \$ w=(w_1, w_2, ..., w_N)\$, subject to the ...
4
votes
1answer
77 views
File deletion takes a long time to delete files
I have a script I need to "duplicate" and modify to allow it to delete certain images based on properties I give this app/script. Currently the script just moves/sorts the images into folders based on ...
5
votes
1answer
54 views
Optimizing bilinear interpolation
I have spent countless hours trying to speed up my bilinear interpolation up. I even tried implementing an SSE version (a double version and a float version), but that was even slower than this ...
1
vote
1answer
21 views
Quickly passing and parsing variable length float arrays
I have this code for parsing for parsing a list of floats of variable length.
...
1
vote
2answers
62 views
Monte Carlo Pi with R + Fortran + MPI
I created a R package to calculate Pi with a Monte Carlo simulation.
My goal is to optimize the parallel function SnowPi as much as possible. This is the ...
2
votes
2answers
66 views
Framerate Measurement Utility
As part of a project I'm working on, I need to measure FPS. In the past, I would do this within the actual project itself, but recently I've been trying to implement more abstract (and reusable) ...
1
vote
1answer
37 views
Query performance of this Select Where each Column is a Select
I would like to know how to improve the performance of the following query:
...
2
votes
2answers
39 views
Live price update with options
I'm very new to JavaScript, so I'm not sure how to optimize the following code (which seems to run fine) further, though I did try to implement a few tips found on the web — such as using local ...
3
votes
2answers
36 views
Extracting and normalizing URLs in an HTML document
I have written code to get all urls on a webpage & put them in a set, and would like tips on simple changes I can make to increase its performance.
...
6
votes
1answer
47 views
Hide and un-hide rows then sort on Worksheet_Activate event
We used this VBA code mainly to hide blank rows and unhide non-blank rows. After that, the second code sorts the rows by a defined column value once the worksheet activates. This process takes too ...
2
votes
5answers
98 views
Sudoku solver in Ruby
All the test cases pass except one of the test case which runs > 10 seconds. What can I do to make my solution faster?
...