Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.
0
votes
1answer
21 views
Trying to optimize Python code that makes heavy use of arithmetic operations on numpy arrays [on hold]
I'm currently working on getting some faster runtimes for some Python code. I've already made a few pretty big strides and sped it up quite a bit, but it still takes a bit longer than I'd like and I'm ...
2
votes
0answers
15 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
7 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:
...
3
votes
1answer
21 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
62 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
42 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
62 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
59 views
4
votes
1answer
98 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
47 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
123 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.
...
9
votes
4answers
541 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
78 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
83 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
68 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
51 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
66 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
67 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
66 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:
...
0
votes
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:
...
-1
votes
2answers
62 views
Finding consecutive occurrences of a value in an array
Given an array, return True if the array contains consecutive values:
...
3
votes
1answer
44 views
5
votes
1answer
42 views
Bottom up (iterative) mergesort in C
I have this C implementation of the bottom-up (iterative) mergesort:
mergesort.h:
...
9
votes
5answers
820 views
Macro code that removes excess rows
I'm a business student who just started to learn VBA. I am trying to write a macro for a project but only have minimal experience actually stepping into the code.
The macro I have written is to ...
6
votes
1answer
75 views
High performance triangle - axis aligned bounding box clipping
Implementation of a Robust (i.e. with a finite plane thickness) Sutherland–Hodgman algorithm for clipping polygons against an axis-aligned bounding box. I use the following code only for clipping ...
5
votes
3answers
113 views
Bubble Sort in Objective-C
Following is Objective-C method implementation I did for one of the most simplest sorting algorithms, Bubble Sort to sort an array of integers.
Note:- I have defined it as a static method in the ...
0
votes
1answer
19 views
Node function to walk through file system and make sure it has a matching db record
I have an app that uses the file system a lot to store generated files (zip files and scss/css fil). When a user generates a file, the metadata and other information is stored in the db for later ...
4
votes
5answers
122 views
3
votes
2answers
117 views
Counting multiples of 3 or 5 using threads
I have a modified version of the first Project Euler problem — where I find the sum of all the numbers below the value 2100000000 that are multiples of 3 or 5 using a multi-threaded program.
The ...
3
votes
0answers
67 views
CUDA program that emulates a kind of cellular automata slower on the GPU than on the CPU
I'm a very new to CUDA, so I'm still trying to understand how to make the best use of the GPU. I've ported a C algorithm to it. This algorithm works by loading the memory with an initial input, then ...
5
votes
2answers
104 views
Mars Rover Simulator
Problem Statement
Consider a rover and a plateau of size nxn. The rover takes three type of instructions L,R and M. 'L' and 'R' rotate the rover in the left and right direction. 'M' moves the ...
0
votes
0answers
39 views
JS timer plugin
This code operates as intended, but with only with two operational timers running. I need the resize event in the match section as I need to retrieve the window ...
1
vote
0answers
10 views
3
votes
0answers
125 views
Data model for complex tree (multiple children and multiple parents)
I'd like to have a discussion on the data model (mostly) for a tree with nodes having multiple children and multiple parents.
I already have a working algorithm, but I'm looking for improvements.
The ...
3
votes
1answer
81 views
Quickly applying gravity force between bodies
I have a function for applying gravity forces between every possible pair of bodies on my game. It is the most used function, and can run more than 100k times per frame so every minor improvement on ...
3
votes
1answer
64 views
Stack from Linked List
I have written a program that takes a linked list and then converts it to a stack.
I would like a code review for my program. Thanks in advance.
Stack.java
...
5
votes
1answer
123 views
Computation of product of permutations
Given a graph \$G = (V,E)\$ with a unique labeling of each vertex, let the transposition \$(i,j)\$ (where \$i,j\$ are the labels on adjacent vertices) represent selecting an edge and swapping the ...
4
votes
1answer
97 views
Simple binary search tree for use in programming competitions
I made a binary search tree implementation in C++ for my personal use in programming competitions.
...
3
votes
1answer
62 views
Simple Vector2D and 3D class
So I implemented a simple vec2 and vec3 classes, I wanted to know what remarks you guys can give me to improve it.
I try to work with c++11 and 14 so remarks on that also will be really great.
I ...
2
votes
0answers
29 views
Physical simulation of diffusion-limited aggregates
The following code generates Diffusion Limited Aggregates on a two-dimensional square lattice. Some of the code has been omitted (e.g. support for differing lattice types and dimensions) for ...
4
votes
2answers
51 views
n-Queens backtracking code
I was learning backtracking algorithms earlier today, and was excited and wrote this code for n-Queens problem. Being my first try at backtracking algorithms, I would appreciate if you guys could chip ...
6
votes
2answers
114 views
Longest palindrome in an array
I am new to programming, and think this code could be improved upon. Any suggestions?
...
5
votes
3answers
245 views
Memory/performance of merge sort code
I wrote up merge sort code for some late night snack. I have gotten it working, but was just looking learn if I was missing anything in terms of efficiency. Could this code be significantly improved ...
2
votes
1answer
45 views
Mandelbrot image generator with parallel iteration
I'm currently trying to optimize this class I have for fractal generation. The equation is meant to be pluggable; I have used z => z*z + c so that it's not using ...
4
votes
1answer
59 views
A Game Of Simon
This is one of the projects from freeCodeCamp. It's a game of Simon (a memory game). I would like a review on my code.
...
3
votes
0answers
45 views
Parse long string in Go
I'm sure that my server can work with better performance, but it's just a dream.
Parsing a very long strings is not so obvious task for me.
I have a server that handles a lot of clients requests and ...
1
vote
1answer
50 views
Javascript Parallax Scrolling Text
I built a 404 page which involves parallax scrolling text. The program updates the position of 100-200 text nodes at each animation frame called with ...