Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.
5
votes
1answer
28 views
Enter my Matrix
Here is my next Java assignment: create a Matrix class that can add and multiply two matrices together. I was given some code as a skeleton and then fleshed it out a bit.
Is there any way I could ...
0
votes
0answers
11 views
Removing/adding/updating items between 2 dictionaries based on 3 rules
I need to do 3 things:
Remove entries that are not present in dic2 from dic1
Update the other data in ...
3
votes
1answer
15 views
0
votes
0answers
10 views
Efficiently index rows of numpy array by exclusion
I need a function that takes a numpy array and a row number as inputs and returns the array (or copy of the array) excluding the given row. I want to do this as efficiently as possible.
...
3
votes
2answers
29 views
Finding a pair of words from two files with a particular MD5
I have two txt files. Both contain 60k+ words in a list. I put together some code to loop through each file and concatenate the strings
...
0
votes
1answer
44 views
Templated linked list in Java
I recently reviewed some data structure concepts, so I implemented my own templated linked list. I am very interested about the code efficient and performance.
...
2
votes
2answers
33 views
Slice chunking in Go
I have a slice with ~2.1 million log message strings in it that I am parsing for regular expression matches. For any matches, I add it to a local slice and then return said slice.
...
1
vote
1answer
41 views
Grabs 10 bytes and converts it into a hex formatted string
I'm working on some code right now where the goal is to take in a byte stream and grab the data from the body of a message. The data is 10 bytes long and is meant to be translated into hex. ...
2
votes
2answers
47 views
Copying rows from one workbook to another
This code will copy data from a workbook and copy it to an existing (and open) workbook. At the beginning of the month this copy/paste works very quickly, but as the month goes on and the data also ...
1
vote
1answer
20 views
Using [ChildActionOnly] for generating links
I have a view which displays a list of items, in each row I'm going to have a link, a link in each row points to different location So base upon a property called ...
2
votes
0answers
23 views
Transform and transpose byte[] of 32bit image data in 24bit array image data
I would like to know if someone can think about a better solution for doing this stuff.
I have an array of raw bitmap data in 32bit format (RGBA). I need to transform and transpose this array into a ...
2
votes
4answers
132 views
Consecutive whitespace reduction
I pursued an according algorithm with an absolute best performance, the following class embodies the solution.
Any comment is welcome.
...
0
votes
0answers
21 views
Can this implementation heavily harm write performance? [on hold]
For some reason I need to reimplement a method of this interface:
Task Save(ISagaData sagaData, Dictionary<string, string> sagaAuditMetadata);
This is the ...
4
votes
1answer
54 views
Randomly choose a game executable from a folder
I've written a Universal Windows Application which allows you to select a folder and shows the icon and name of a random executable from anywhere in that folder. The intent is to be a Game Roulette, ...
0
votes
1answer
50 views
PHP Instant Message API
I am creating a chat API for Android developers, but it's slow -- the chat app is getting messages a little bit late.
How can I improve the performance of my code?
...
0
votes
1answer
93 views
Finding all possible combination of alphabets of length 5
The code finds all the combination of alphabet with length 5 and saves it in a list(its ASCII value, minus 97). I want to optimize the code to reduce execution time.
...
1
vote
0answers
32 views
Reading content of directory for each HTTP request
I have a piece of code written in node and I wanted to know if I am in the right direction. Basically I have a site where the homepage lists 6 vehicle cards. Every time the page is requested I do the ...
1
vote
1answer
55 views
Returning the common divisors of two integers
I have written this function that returns the common divisors of two integers. When called recursively 10 times with big integers ranging in 100000000, it takes over 5 seconds. How can I improve it so ...
1
vote
1answer
64 views
7
votes
1answer
81 views
Swift replacement for C's for-loop
I recently wrote an entry on my blog regarding unit testing using prime numbers as an example.
When I wrote the entry, I wrote my code keeping in minding that proposal SE-0007 has been accepted for ...
6
votes
1answer
120 views
A* algorithm in C# for use in a game
I recently started up again on a 2D game engine I have been working on over the last couple of years. I managed to implement a version of the a* algorithm that seems to work fine for my game, but it ...
2
votes
1answer
32 views
Project Euler #7 in C: find 10001st prime using something like Sieve of Eratosthenes
I've gotten a solution for Project Euler #7 in C (find the 10,001st prime). I came up with the very simple algorithm myself (from what I can tell it's similar, if not identical, to the Sieve of ...
3
votes
1answer
49 views
PANDAS spatial clustering
I'am writing on a spatial clustering algorithm using pandas and scipy's kdtree. I profiled the code and the .loc part takes most time for bigger datasets. I wonder ...
3
votes
2answers
83 views
4
votes
1answer
35 views
Sieve of Eratosthenes in Erlang
I just started learning Erlang. Here is my crack at the Seive, based on (https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf):
...
3
votes
1answer
45 views
Small HTML / JS drum machine
This is just a simple little drum machine. Since it loads sounds files, I can't just put it on JSFiddle. I tried Github pages too, but am not sure how to get the sound files working. However, you can ...
3
votes
4answers
97 views
C++ Interrupted Bubble Sort
I've written an interrupted bubble sort, which prints the intermediate result after some specified number of iterations of bubble sort. But I seem to have an speed issue. Could anyone help me spot ...
4
votes
1answer
67 views
Octree for voxels
I am creating a game with destructive terrain. Before I used a flat array to store the blocks, in chunks of 32^3.
As I am aiming for detail and long view distance I would of course need some sort of ...
5
votes
2answers
23 views
Optimize Game of Life
I'm a beginner at coding and the past days I tried to write the famous "Conway's Game of Life" in Angular.js. Right now I'm done with the code and the game works. But if the size of the playground ...
1
vote
2answers
51 views
Implementation of merge sort in Python
I was working on an assignment and I was hoping to know if the merge sort algorithm I wrote in Python was not making any unnecessary computations.
...
-4
votes
0answers
31 views
Optimizing triple for loop C++ [closed]
I currently have a C++ function that for each i from 8 to n, it finds a result for each pair (j,k) where k!=j and j,k less than i, and prints the max result for that i. The output should look ...
4
votes
1answer
47 views
Data analytics on static file of 50,000+ tweets
I'm trying to optimize the main loop portion of this code, as well as learn any "best practices" insights I can for all of the code. This script currently reads in one large file full of tweets (50MB ...
5
votes
1answer
28 views
Perl recursive copy and move functions
I know a module like this already exists on CPAN, but I wanted to write my own simplified version that accepts wildcards in the input.
I don't write many Perl modules so I figured I would post the ...
0
votes
1answer
55 views
HTML Pagination Generator
I have created a function that helps me generate pagination really easily but I am concerned about its performance mainly.
The function accepts 2 parameters:
A list of items (has meaning in the ...
1
vote
3answers
119 views
A service to monitor CPU usage
I have written a windows service that I am currently not that happy with as I am facing design issues (first windows service).
The aim of this service is to monitor CPU usage and send an alert when ...
4
votes
1answer
43 views
SICP - exercise 2.69 - generate a huffman tree from a set of ordered leaves
From SICP
Exercise 2.69: The following procedure takes as its argument a list of
symbol-frequency pairs (where no symbol appears in more than one pair)
and generates a Huffman encoding tree ...
6
votes
2answers
82 views
Attempting to run multiple simulations of the Gillespie algorithm for a set of stochastic chemical reactions in less than 10 minutes
I have written Python code that generates a plot. In the code below, when I set maxtime = 0.1, the program takes ~50s and when I set ...
2
votes
1answer
81 views
Project Euler Q7 - 10001st prime
The problem is (source)...
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?
This is my second attempt ...
4
votes
1answer
48 views
Recursive backtracking Sudoku solver
I'm trying to learn more algorithmic techniques and I came across an interesting application of recursive backtracking: solving a Sudoku puzzle. I'm looking for a review concerning code style, ...
4
votes
1answer
44 views
Highlighting and copying spreadsheet rows that match a criterion
I use the code (provided below) to check for certain criteria in a row. In this case, if cell F in worksheet "Swivel" contains "After Dispute For SBU" then that row needs to be highlighted in yellow ...
1
vote
0answers
48 views
Restarting properly
I have an activity with a timer in it, which starts an activity when the timer goes down. Before, when onPause() would get called after a phone call, my activity ...
3
votes
1answer
46 views
Creating a table within a .csv file
I recently made a post on Code Review entitled Writing lists to .csv file. I found the feedback extremely helpful, and wished to provide a continuation of that particular topic; of working with Python ...
3
votes
2answers
49 views
Checking all elements against each other for elements strictly worse
Consider the following function:
...
0
votes
1answer
108 views
Hex-to-octal converter
The code converts hexadecimal into octal. The function is working, but it takes more than a second to process the input. How can I optimized this?
...
4
votes
1answer
61 views
Finding the sum of all the segment counts of a 7-segment display in a range
I'm working on a programming challenge and the question is as follows:
Once Max found an electronic calculator from his grandfather Dovlet's chest. He noticed that the numbers were written with ...
2
votes
1answer
47 views
Double integral solver in TI-84
Here's a program I made for estimating a double integral over a general region. It's pretty accurate, but it's VERY, VERY slow. (Getting an accurate enough result takes about 30 seconds)
Here's the ...
1
vote
0answers
26 views
Optimal use of Python 3's multiprocessing package to create sudoku grids
I want to create Sudoku grids using Python. As it's pretty slow if I want to create a bunch of grids, I decided to use multiprocessing.
My computer has 4 virtual ...
0
votes
1answer
47 views
Using as few queries as possible for many table associations
I have a table containing about 30k rows of data and there's several table associations. The problem is that there's like 18 columns, and each column requires 1 db query.
Here's an example of what ...
2
votes
0answers
14 views
Speed up structured NumPy array [migrated]
NumPy arrays are great for both performance and easy use (easier slicing, indexing than lists).
I try to construct a data container out of a ...
3
votes
1answer
72 views
JavaScript dragon slayer game (Codecademy)
I'm currently doing the Javascript course at Codecademy, and decided to customize their dragon slayer game. I would appreciate any help/pointers that can help me optimize the code. There's a lot of ...