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)

0
votes
0answers
3 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. ...
2
votes
0answers
21 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 ...
4
votes
0answers
16 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 ...
0
votes
1answer
17 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
110 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. ...
12
votes
2answers
148 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 ...
0
votes
1answer
45 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 ...
3
votes
1answer
53 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 ...
1
vote
0answers
28 views

Making HTTP request using Haskell wreq

The program makes HTTP requests (checks video stream status) and calls an external program. ...
10
votes
8answers
1k 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
78 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
0answers
29 views

A 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
53 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
64 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
39 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 ...
-1
votes
0answers
33 views

WebGL performance with ~5000 movable rectangles (ivanK)

Here's my runnable code in webpackbin (drag the little rectangles). The code for dragging could probably be more concise, but this is just what I hacked together. ivanK graphics library Basically, I ...
4
votes
0answers
41 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
53 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
77 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
47 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 ...
2
votes
1answer
47 views

Finding permutation from given lexicographical rank

I wrote the following little piece of Python code to take in some integer, and return a permutation that has that rank in the lexicographical ordering of permutations. While this works, I'm worried ...
1
vote
0answers
44 views

Form validation library

I am writing an open source library but its been to long since I have worked in JavaScript. Here is the initial working code fragment: ...
0
votes
1answer
18 views

Assign values to a matrix based on the location of non-zero elements in another matrix

I have a matrix, A containing ones and zeros. I want to create a new matrix B where the non-zero elements are in the same ...
6
votes
2answers
94 views

Rectangle-segment collision detection

I am working with C++ and SDL, hoping to create a game later. I am implementing the collision detection between rectangles and segments. I found this (NateS user's solution) about line-rectangle ...
0
votes
0answers
24 views

Dataframe helper in R

In order to have a "unified" (I realize how ambitious this actually is) syntax when working on dataframes, I wrote the following functions that is a general purpose dataframe set of tools in R. ...
6
votes
3answers
74 views

Loop through a unique combinations driven by choices

I am trying to optimize my code and make it as fast as it can be, I have researched as much as I can and am now asking the community for any tips because there are definitely people more experienced ...
0
votes
0answers
13 views

Add and merge 2D array items so no nested duplicates on the outer array

this.collisions is a 2D array containing a list of collisions that, when bodies collide, they should be added to it. Here's an example: ...
4
votes
2answers
43 views

Inserting data into a file

So, given a file with the following format: [header] line of data line of data line of data line of data [header 2] line of data line of data line of data ... I add a ...
7
votes
2answers
81 views

Sum of prime factors of binomial coefficients over 9000!\${}\$

The problem I have lately been working Project Euler: 231: The prime factorisation of binomial coefficients The binomial coefficient \$ ^{10}C_3 = 120 \$. \$ 120 = 2^3 × 3 × 5 = 2 × 2 ...
2
votes
1answer
46 views

Queries for the number of users seen each day

The below code returns an array filled with the number of users last seen for each day for $dayCount number of days that is specified via a parameter into the ...
1
vote
1answer
100 views

Merging two square matrices

I would like to optimize a snippet of code, which uses a multiple nested if statements. I am looking for a formula to make it as a combination of multiple arrays ...
2
votes
2answers
63 views

Merge sort Python implementation

Is this efficient? ...
4
votes
1answer
104 views

Clearing filters, copying a range, and then pasting a formula down a row

Novice coder here. I have the following code to perform a few actions like clearing filters, copying a range, and then pasting a formula down a row till the last line. It works perfectly, but it ...
2
votes
1answer
49 views

Scrolling game very slow

I am trying to make a scrolling game in Tkinter. However, with all my for loops and functions it is extremely slow. I am reading the tutorial from Khan Academy's advanced JS. In their JS game ...
-4
votes
1answer
141 views

C-type classes in C++

I have written some improved C-type classes in C++ and wondered whether these are suitable for professional use or in which way they would have to be improved to be professional or more powerful. ...
10
votes
4answers
567 views

Copying values from one sheet to another

I am trying to copy values from one sheet to another using loop with two conditions and it is very slow. Removing conditions from code doesn't have any effect on the speed of the execution. I already ...
4
votes
2answers
84 views

Get every information about the Reservation

I'm developing a plugin for Revit (a software to make 3D buildings). The goal is simple to understand. When there is an intersection between a Wall and a Duct I create an object called Reservation at ...
4
votes
2answers
85 views

Social network queries for profiles, posts, and followers

The code below is for a social networking system. The problem is that when there are many posts and many followers, the performance is slow. Is something wrong with the queries and the script below? ...
3
votes
1answer
74 views

Enum string parse and get custom attribute assign to array

I wrote a code which: - parse string to my enum - get description from enum - assign to string[] array ...
4
votes
1answer
58 views

Vectorizing a biometric matching score calculator

I am working on a biometric matching system and I would like to have few suggestions regarding vectorizing the following code: ...
0
votes
1answer
68 views

Project Euler #50 Consecutive prime sum

I'm having trouble optimising the project euler #50 exercise, it runs for around 30-35 seconds, which is terrible performance. The prime 41, can be written as the sum of six consecutive primes: ...
4
votes
1answer
71 views

Comparing three data structures for dealing with probability distributions in Java

Introduction Suppose you are given three elements \$a, b, c\$ with respective weights \$1, 1, 3\$. Now, a probability distribution data structures will return upon request \$a\$ with probability 20%, ...
0
votes
1answer
71 views

Password Protect Page with PHP

I am using the following code to password protect pages on my site. This is how I am including it on a page: ...
1
vote
0answers
26 views

Returning direct status changes of user statuses

I have a query which returns direct status changes (no intermediary changes) of user statuses: ...