Questions tagged [performance]
Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.
8,590
questions
2
votes
2
answers
206
views
Movement and collision function
I just want this code optimized to the max and I don't mind knowing if the optimization is pretty much at the max already or if I am doing movement and collision wrong. My game is a 2d Minecraft style ...
2
votes
1
answer
169
views
Simulation of sand particle collision
I am making a module that allows you to create sand and simulate it. I have successfully done this, but it runs very slowly. I need this to be able to simulate at least 1000 particles, at a fps higher ...
1
vote
1
answer
144
views
Find Reddit comments with a particular keyword
I am writing a loop (in R) to webscrape Reddit posts - using Reddit's API ("Pushshift").
Essentially, I would like to get every comment that contains the word "Trump" between now ...
0
votes
0
answers
43
views
Euler's totient function in Rust, with a performance difference between generic and classic functions
I recently started to program in Rust, having like 2 good years of experience in C++, I thought it would be possible to directly switch to Rust without following a lot of tutorials, especially knowing ...
0
votes
2
answers
54
views
VBA code which exports data from Access to Excel and then loops through the Excel file
I have a couple of VBA loops that work in the blink of eye when I execute them through Excel, but doing this as part of an Access VBA application takes like 15 minutes. The loops run through each row ...
2
votes
1
answer
97
views
plotting Monte Carlo Simulation from excel sheet
I have created the following code:
Option Explicit
...
3
votes
1
answer
33
views
request data and print results
On last test, the below code takes approximately 10 seconds to download then print the data from 10 url's. I wish to speed this up as much as possible as later on I plan to expand this further and use ...
4
votes
1
answer
120
views
Add two huge base-10 numbers
This is some assembly code I've written to add two base-10 numbers. The input and output are represented as null-terminated ASCII strings, with digits in big-endian order.
I have also provided ...
5
votes
4
answers
292
views
StringPool in C++
I wrote a simple string pool for my compiler in C++ and want to hear your thoughts on its design.
String pool has 2 functions: intern and ...
3
votes
1
answer
63
views
Create a forecast matrix from time series samples
I would like to create a matrix of delay from a time series.
For example, given
y = [y_0, y_1, y_2, ..., y_N] and W = 5
I need to create this matrix:
...
9
votes
1
answer
165
views
Improving the speed of an MD5 implementation from scratch in C++
I wrote an implementation of the MD5 hashing algorithm from scratch in C++, following the original RFC: https://www.ietf.org/rfc/rfc1321.txt . It works as expected, and the outputs match all the test ...
4
votes
3
answers
245
views
Increase efficiency of stick cutting algorithm
I have this typical code interview type problem.
Suppose you have a stick of length n. You make X cuts in the stick at places x1, x2, x3 and so on. For every cut in X cuts you need to print the length ...
0
votes
4
answers
171
views
Method that finds a pair of integers that sum to a specified target
I have a very simple method that returns a tuple of integers in a list that sum to a specific target sum. The method works as expected, however, with a large list, it is slow. I have looked for ...
5
votes
1
answer
82
views
blackjack dealer hand generator
I wrote a piece of blackjack code - for dealer dealing cards to himself (python). My question is how can I make it more efficient, faster and neater. I ran it for 1.000.000 iterations and it took 14.7 ...
1
vote
1
answer
142
views
Create normals from triangulated surface
Objective
I have a 3D face mesh triangulated. I have computed the midpoint of each triangle in the mesh, and I have the normal vector (n1, n2,n3) for each triangle. The objective is to create a 2D ...
0
votes
0
answers
40
views
Update cell format based on adjacent cell values
Trying to speed up this macro, it just loops through 'C-L" columns and changes the format based on adjacent cell values.
...
3
votes
2
answers
123
views
Goats up hills II: revenge of the goat
This is a continuation of Goat racing up a hill (C++ hiring take-home) . This is an interview take-home challenge that has been translated to avoid compromising the company's question.
Problem ...
6
votes
4
answers
666
views
Counting the number of patterns that exist in a particular string
I am solving this problem where the function returns the number of times a pattern is found in a said string word. It could be easily solved via ...
5
votes
1
answer
905
views
Remove background from a directory of JPEG images
I wrote a code to remove the background of 8000 images but that whole code is taking approximately 8 hours to give the result.
How to improve its time complexity? As I have to work on a larger dataset ...
0
votes
1
answer
91
views
list possible combinations of pairs of actions for stocks
What do you suggest to make this code faster? This code gets all possible combinations of actions for a certain number of stocks in pairs in the format ...
11
votes
3
answers
1k
views
Remove leading zeroes from the beginning of a string
I want to remove leading zeroes (for a big integer library I'm currently making) in numbers represented as char arrays.
I chose assembly for speed, but in order to simplify making the algorithm and ...
4
votes
4
answers
237
views
Find the missing and duplicated numbers from shuffled range
I'm solving "Unknown amount of duplicates. One missing number.":
In this kata, we have an unsorted sequence of consecutive numbers from a to b, such that a < b always (remember a, is the ...
3
votes
2
answers
222
views
Euler Project: Sums of Digit Factorials
MY CODE:
...
1
vote
0
answers
55
views
Follow up: ReversibleList V2: a list that is "reversed" in O(1) time
This is a follow up to ReversibleList: a list that is "reversed" in O(1) time [1]. Thanks for the suggestions!
Any suggestions for improvements are welcome!
A ...
4
votes
2
answers
262
views
generate lottery numbers to store in a text file
I scripted a program in python to generate lottery numbers for user. There are two playing methods:
Lotto6aus49: User can choose any 6 numbers out of 49.
Eurojackpot: User can choose 5 numbers out of ...
2
votes
1
answer
130
views
Card game simulations, with a multithreaded version slower than the single-threaded one
I'm new to rust and I'm trying to build a card game simulation to find all of the best actions with all possible hands. This requires a lot of simulations and my first 3 million are already taking a ...
4
votes
1
answer
82
views
0
votes
0
answers
50
views
Three-dimensional DCT implementation for GPU computation in Matlab
This is a follow-up question for Three-dimensional DCT spatial frequency components illustration and Parallel 3D Discrete Cosine Transformation Implementation in Matlab. I am trying to perform three-...
2
votes
1
answer
59
views
Processing charge current error messages with HashMap<>
I have certain error states that I am displaying in my Android TextView but only one message is displayed at a time and if all values are set to 0, no message is displayed. So, I check all the values ...
1
vote
1
answer
39
views
Observe LiveData to indicate whether or not to display TextViews in MVVM
In the context of MVVM, is this an efficient way to communicate to the view that I should display some TextViews? Any advice on how I can improve it?
ViewModel code:
...
4
votes
1
answer
94
views
takes a word/combo of numbers/sentences and displays duplicate letters
I am fairly new to coding and was wondering of any tips to improve the code, sorry if it's a pain to read, thanks :)
...
2
votes
1
answer
45
views
Implementation of a multi-dimensional array as a single memory buffer [Part 2]
A couple days ago I posted my first implementation of my data structure here, which implements a cache-optimized tensor representation. I have worked the ideas from the responses into my ...
4
votes
1
answer
160
views
Need for matrix multiplication speed
I need help to make matrix multiplication in C run as fast as
possible. On my AMD Phenom(tm) II X6 1090T, my program multiplies two
square singe precision 4096x4096 matrices in about 6.9
seconds. ...
0
votes
1
answer
305
views
Randomly pick item from list with variable probabilities
This is supposed to randomly pick out the pieces for a Tetris clone. When a piece doesn't get drawn, its probability of getting drawn increases. I want to know if there is a way to do any part of this ...
4
votes
3
answers
107
views
Implementation of a multi-dimensional array as a single memory buffer
There is an updated version of this code with some of the recommended changes made here.
I have created an implementation of a multi-dimensional array which utilizes a single continuous memory buffer ...
7
votes
3
answers
568
views
Algorithm which finds the count of values are smaller to the right than the current one (in the list)
I have to solve the task which finds the count of values, are smaller than the current one, located to the right.
Here is the example:
...
3
votes
0
answers
134
views
Merge two strictly increasing sequences, without duplicates
This work is motivated by Sum of natural numbers below threshold, where several Swift solutions to Project Euler #1 (with arbitrary upper bound) are provided.
One way to think of it is to
start with ...
3
votes
2
answers
170
views
Intercolumn statistics between columns in a dataframe
I have a df and need to count how many adjacent columns have the same sign as other columns based on the sign of the first column, and multiply by the sign of the ...
0
votes
1
answer
65
views
Find longest "binary gap" [closed]
I'm doing a few challenges and I found this one on Codility:
A binary gap within a positive integer N is any maximal sequence of
consecutive zeros that is surrounded by ones at both ends in the
...
2
votes
3
answers
112
views
Find long palindrome multiplications in modern C++
I'm a former C# programmer, updating my rusty C++98 (perhaps I should try Rust instead) to modern C++20. My main goal is to get used to C++ standard library types and algorithms.
I chose to solve a ...
1
vote
2
answers
76
views
Copying formulae between sheets
I am currently running multiple macros on a large volume of files however watching it go through its processes today I realise one of my issue is that my loop runs through my workbooks 3 times instead ...
-2
votes
2
answers
91
views
Optimizing Netwide Assembler codes in Microsoft Windows
I am a novice in assembler programing, I will will appreciate if someone could review these NASM assembler code for me. Is about encoder decoder.
The encoder performs the following:
pads the ...
5
votes
5
answers
888
views
Palindrome Permutation string
I’m starting to learn C++ by doing a lot of exercises, and I need your help so I can improve,
Here is how it goes, I will try to solve an exercise and post both the ...
3
votes
1
answer
96
views
Hash table C implementation - Separate Chaining
I've written a C implementation of a hashmap of strings including the basic operations and a strategy for handling hash collisons.
Additionally, I've included some tests, specifically for cases ...
6
votes
3
answers
862
views
Space encoder for URL
I’m starting to learn C++ by doing a lot of exercises. I want you to point me to where/what improvements I can do to make my code better.
The exercise:
write a URLencode function that takes a string ...
2
votes
1
answer
74
views
Find all non-crossing tuples which has the same content with a given tableau
Let T be a semistandard Young tableau of rectangular shape. For example,
[[1,2,4],[3,5,6]]
is such a tableau, where [1,2,4] and [3,5,6] are columns. All non-...
0
votes
0
answers
26
views
Algorithm to generate splats from point clouds
I am trying to write a program to generate splats from point clouds from following this paper and this paper.
The function I have to generate 1 splat is here:
...
1
vote
1
answer
72
views
Logically validating list of comparisons (inequalities) and returning the node color
Given an arbitrary list of operations as follows:
...
1
vote
0
answers
92
views
C++ PEXT/PDEP implementations
The common implementations usually reference: https://github.com/fmatthew5876/stdcxx-bitops/blob/master/include/bitops.hh
I styled my version to match (except for the ...
6
votes
4
answers
2k
views
Find all ways to express each of a list of even numbers as the sum of 2 positive, even numbers
This code was a challenge from a friend. Essentially she wanted a way to
"Divide an even number into 2 even numbers."
So I made this quick and dirty Python program to find the solutions up ...