Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.

learn more… | top users | synonyms (4)

2
votes
2answers
32 views

Optimize a simple and quick python script for transposing a .csv file

I need to transpose the following file output1.csv, which is is a result from a quantum chemistry calculation into a single colum efficiently: ...
3
votes
1answer
28 views

PHP & AJAX CAESAR CIPHER ENCRYPTED chat script - Slow in performance

I have made an attempt to make a chat script and its working as required but the problem is that it is slow on slower connections and sometimes even on fast connections. Sometimes while loading the ...
4
votes
2answers
795 views

Binary difference checker, needs to be more efficient

My code needs to take two ints and then check those ints to see if their binary representations have any differences. The function convertBits returns the number of differences between the two binary ...
4
votes
2answers
65 views

Python Takuzu solver

If you are unfamiliar with the logic puzzle game Takuzu, I learned how to play it and was inspired to make the project from this challenge posted on reddit. The short version of the game is it's a ...
1
vote
0answers
51 views

Horizontally concatenating the entries of two matrices, and padding with NaNs

I have two matrices a and b that have, on each line, some values (null or not) and then a bunch of zeros at the end. I want to ...
2
votes
1answer
40 views

A module to make JSON in Python easier

I recently wrote the livejson module as a way to make working with JSON in Python easier. The idea of the module is that you initialize a livejson.File, and then ...
0
votes
0answers
25 views

Perl script performance

i am new to perl and want some help in tuning this script if possible cause it takes time if I increased my array. also if I use warnings I get a lot of warnings ...
5
votes
1answer
123 views

Broken keyboard challenge

Inspired by Reddit r/dailyprogrammer Help! My keyboard is broken, only a few keys work any more. If I tell you what keys work, can you tell me what words I can write? The program works fine, ...
6
votes
0answers
49 views

Create edges from cells

I have a (large) number of nodes and (triangular) cells, e.g., cells_nodes = [ [0, 3, 1], [0, 2, 3] ] This example represents the small mesh (...
-1
votes
0answers
35 views

Find the possible mathematic expressions from the given integers to evaluate a value

How can I decompose this code into multiple threads so that it can run in parallel and enhance the efficiency (speed)? Can anyone suggest how I can use OpenMP here and where I can apply an OpenMP ...
0
votes
2answers
84 views

C++ XOR Function

This XOR function is costing my program too much time (specifically the conversions.) How can this code be made faster? ...
2
votes
0answers
46 views

In-memory B-Tree

I know B-Trees are meant to be used for external memory, but I implement it to understand the algorithms involved in insertion and deletion. Also, I didn't use a vector because I was asked not to use ...
3
votes
1answer
42 views

Vampire number generator

Inspired by Reddit r/dailyprogrammer A vampire number v is a number v=xy with an even number n of digits formed by multiplying a pair of n/2-digit numbers (where the digits are taken from the ...
3
votes
2answers
44 views

Distinct unordered pairs of an array which satisfy a condition

I came across the below problem in a coding challenge: Let's define 2 functions, \$F(i)\$ and \$Val(i,j)\$, for an array \$A\$ of size \$N\$ as follows: $$ \begin{align} F(i) =& \sum_{j=i+1}^{N} ...
4
votes
1answer
92 views

Tetris random piece generator

I was inspired by this Reddit /r/dailyprogrammer challenge: Contrary to popular belief, the tetromino pieces you are given in a game of Tetris are not randomly selected. Instead, all seven pieces ...
5
votes
1answer
71 views

Reversing a word or sentence

Was just wanting some general feedback on the below code regarding 1. Readability 2. Structure 3. Efficiency ...
3
votes
0answers
43 views

Recursive Breadth First Search Knights Tour

This program was written on Windows 7 using Visual Studio 2012 Professional. Some of the issues encountered may have been fixed or changed in a more recent version. This is a quote from my second ...
0
votes
0answers
29 views

Palindromic prime search using the Sieve of Atkins

I am working on a project that deals with prime numbers and am currently looking for a way to make the function max_palprime() work faster and possibly simpler. ...
1
vote
3answers
65 views

Searching values of range X in range Y

This allows me to search each cell J4:J6525 in range K4:K6525. If it is found it will paste the values in Offset(0, 2) (column M). I run it for files with more than 60000 lines, and sometimes much ...
4
votes
2answers
80 views

A String.prototype.diff() implementation (text diff)

I just had the idea to develop an algorithm to calculate and highlight the difference between two strings. I know that there are already some libraries to do the job but i just tried to make my own. I ...
5
votes
3answers
220 views

Finding the duplicate with an array with 1,000,000 integers between 1 and 1,000,000

I recently had an interview and got to phase 2 which is a coding assessment. One of the questions was: Given an array with 1,000,000 integers between 1 and 1,000,000, one integer is in the array ...
1
vote
1answer
32 views

Solving for a seed value in R

I'm trying to reproduce a gbm model which was estimated without a set.seed value. To do so I need to determine what seed was ...
0
votes
0answers
36 views

Permutations Script Needs Optimization

I have functions of permutation : ...
4
votes
1answer
52 views

Custom Python 'Server Status Checker'

I've written a home-grown solution for checking the status of my servers. This is both an exercise for me in learning further about Python, but it's also critical to status-checking critical things ...
1
vote
1answer
65 views

Neural net in C++

I wrote a Matrix struct and a neural net that uses it. Why is this slow? Gprof blames Matrix::operator()(int, int) which I ...
0
votes
0answers
46 views

Fastest way for multiplying a matrix to a matrix [migrated]

Let A and B be n\$\times\$n matrices. In my code this multiplication takes one minute, is there any way or packages that can make this calculation faster? I only found a command in R for a matrix by ...
2
votes
1answer
47 views

Copy sheet contents faster in Excel

I have code that opens a workbook and copies the sheet to the workbook running the code. I know activating is generally bad for speed but I can't figure out how to speed this up anymore. The data ...
2
votes
2answers
128 views

How do I write my multithreading code correctly so that it is faster than a single thread?

I have the following code that I am trying to optimize. I am running it on a Linux machine with 24 cores. So, I thought I could use multi threading to make it faster. But multi threading is some how ...
5
votes
3answers
123 views

Console RPG - show cycle optimization

I have this RPG game and this has elements such as the map, the monsters and the items. The monsters and the items are stored in Lists and every time I want to show ...
0
votes
4answers
141 views

Program to display array elements in the ascending order of number of factors each element has

Input: 1000 23 100 26 32 Output: 23 26 32 100 1000 Since 23 has '2' factors and 26 has '4' factors and 32 has '6' ...
2
votes
1answer
77 views

Prime number checker in Python 3 - follow-up

I have updated my code from the last time it got reviewed. If anyone has some more suggestions on how I can improve this and/or make it faster it would be appreciated! ...
3
votes
0answers
30 views

Animation for android ImageViews acting as game pieces

My question is about how to achieve a well-performing animation for a set of ImageViews, so that the foreground fades away and the background stays the same. ...
5
votes
1answer
82 views

Clustering nodes with Hamming distance < 3

I want to speed up the following code, which is from an algorithm class. I get a list of 200000 nodes where every node is a tuple of the length of 24 where every item is either a 1 or 0. These ...
7
votes
1answer
49 views

A CNN in Python WITHOUT frameworks

Here's some code that I've written for implementing a Convolutional Neural Network for recognising handwritten digits from the MNIST dataset over the last two days (after a lot of research into ...
5
votes
2answers
150 views

Unexpected Low FPS while drawing images

I am in the process of making a game, and during this endeavour, I have come across problems maintaining a good frames per second while drawing my sprites. When I draw my background image, my frames ...
7
votes
2answers
120 views

Mad Libs Generator

I created this Mad Libs generator, but I don't know how to get the value of the key "ans" into a format string tuple. I feel like it's not Pythonic and that it's very convoluted and over-complicated. ...
15
votes
2answers
253 views

Guitar Hero III Bot

I made a Guitar Hero III bot for PC. I was able to beat the song "Through the Fire and Flames" on Expert with the bot which can you see here. If you watched the video, you can see that the bot misses ...
6
votes
3answers
212 views

Flatten an array

I have got this interview question which has asked me to write a production level code which flattens the arbitrary nested array of arrays. Code ...
4
votes
3answers
164 views

Find expressions equal to a given number using 15 integers with 4 operators

For example, given 15 integers 70, 75, 32, 4, 64, 98, 73, 52, 36, 88, 96, 58, 79, 39, 75 How can we obtain is 72? 4 operators can be used for the 15 integers to ...
2
votes
0answers
44 views

Low performance of HTTP request using Haskell wreq

The program makes HTTP requests (checks video stream status) and calls an external program. ...
13
votes
9answers
2k views

Given three numbers, find the second greatest of them

I've just coded this for my country's programming Olympiad. I want to know if this method is a good approach in terms of readability and performance. I would also like to know how to improve it. Note:...
-1
votes
3answers
91 views

Shortest prime number generator we could come up with?

I worked with a friend on the following prime number generator. Our goal was to make it as short and as fast as possible. This is what we came up with: ...
2
votes
1answer
121 views

PHP web crawler

I'm working on a "nice" crawler that start with one URL, and find the other URLs to process each page, a kind of "Google" crawler, to index pages. I worked hard on this crawler to respect many points ...
3
votes
3answers
58 views

List(Of ) like operation in macro

NOTE: I previously asked this question in Stack Overflow and got pointed here. I have a macro that I am trying to get running a little more quickly. The intent of the macro is to merge multiple files ...
6
votes
2answers
72 views

Crop black border of image using NumPy

Objective: Crop the image so only the number stays in the image Problem: Slow Performance I have code that crops an image. The image pixels are 0 or 255. There are no values between. The ...
5
votes
2answers
42 views

Splitting a CAN bus log in .asc format

I've written a quick script for a coworker to split a large CAN log into smaller chunks. (If you're not familiar with CAN, it's a communication protocol used by the ECUs in many cars.) I know where ...
4
votes
0answers
50 views

Knights Tour - Improved Refactored Recursive Breadth First Search for

This development and testing was done on a Dell M6400 Laptop (Intel Core 2 Duo) running Centos 7, g++ compiler, compiler switches -O3 -std=c++0x -D__cplusplus=201103L. (machine bought August 2009 with ...
4
votes
2answers
56 views

Cython: Weighted Random Choice

I have a Cython function the takes a list of weights/probabilities (double) and returns a random index into the list. For example ...
5
votes
2answers
78 views

Function to check truth value of a specific statement

I want to check the truth of A + B - (A & B) == A | B for N-bit numbers. For example, here's a "truth" table for 2-bit numbers. (I know I'm taking liberty with ...
1
vote
1answer
50 views

Permutations part two

This is a follow up from this question. The goal is to make some function that can return the number of possible permutations with repetitions. As Gareth pointed out there is a nice formula for this ...