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,700
questions
1
vote
0
answers
89
views
Python script that maps natural numbers to lattices in a spiral-like manner
This is a Python script that maps natural numbers to lattice points in a spiral like manner. It maps all natural numbers to all points with integer coordinates, and it produces a list of coordinates ...
2
votes
1
answer
90
views
Generate a valid private key from public key
Given a public key, I want to generate a corresponding private key. I know this will take at least decades or centuries on average to achieve.
I am wanting to increase performance as my current code ...
0
votes
1
answer
69
views
Changes hash to allocate values as directed
Let's say you have a hashmap of sub-systems that a spaceship is currently directing power to and a second hash of sub-systems where the power should now be directed to.
Create a function that returns ...
5
votes
1
answer
131
views
uint24_t implementation ported to Windows
I coded stuff for an embedded device where int is 24bits. I wanted to port uint24_t and ...
3
votes
5
answers
161
views
Calculate a math sequence that converges
Thanks for taking the time to read this. I could use a few pointers. I have written much better code but wrote this as a quick test. There is obviously a major issue/s somewhere except for the ...
2
votes
2
answers
80
views
Generate a checksum for this input
I am inputting a file of uniq -c | sort -nr and I need to
take the string from the file,
generate a unique id of the string and then
Output a pipe separated value ...
6
votes
1
answer
127
views
basic Hartee-Fock program to compute the total energies and some properties of a molecule
I am trying to write a basic Hartee-Fock program that computes the total energies and some properties of a molecule given as an input. The code uses Cython to statically compile the computationally ...
1
vote
0
answers
78
views
Performant 2D Grid Cluster Finder Algorithm
I would like to vastly improve the speed of the second part of this algorithm to find clusters of points on a 2D grid.
Each point is represented by a Region on the ...
1
vote
0
answers
47
views
Architecting my Compose UI
I have designed a layout that includes recipe details and three CTAs in the app bar to share, delete, and edit recipes. I need feedback regarding the architecture of my Compose UI.
...
3
votes
1
answer
127
views
Improving execution time of physics, data acquisition triggering system simulation
Background
I'm attempting to write a physics simulation code, one portion of which involves simulating the triggering system of some equipment. The equipment works as follows: environmental noise (...
0
votes
1
answer
80
views
Create and store the level data for a remake of Super Mario Bros game
I am trying to remake Super Mario Bros. in JavaScript and I am trying to figure out if there is a more efficient/shorter way to create and store the level data. I have created 1-1 and here's what the ...
4
votes
1
answer
148
views
AutoComplete-Esque Tree
I've written a tree data structure that takes in input from the user, and stores the each letter based on the previous letter in the text. I'm not sure what this is called, but the closest I can find ...
4
votes
2
answers
368
views
Merge a list of deeply nested HashMaps
Suppose I have a list of hashmaps (<String, Object>). Values can be either scalar types or a nested HashMap with the same type.
I need to merge a list of this ...
6
votes
1
answer
168
views
C++ Eigen/Mex function to perform two pagewise convolutions on a 3D matrix with a simple kernel
I am trying to accelerate an algorithm where I am computing a 2D variance of many complex matrices stored as pages of a 3D array in Matlab. My implementation uses a Mex function with the C++ Matlab ...
0
votes
1
answer
29
views
Reduce run time in Clojure
I have a task which runs sequentially. If I have hundreds of thousands of tags, it is very time consuming. Can this be modified to run the task in parallel? Works fine upto 100 tags
...
8
votes
1
answer
173
views
Lightweight general-purpose graph library in C++
As a personal side project I started building a graph library in C++ (I know, very original). The code is open source, but for the purpose of this question I will provide the relevant details and the ...
2
votes
1
answer
74
views
Applying cointegration function from statsmodels on a large dataframe
I need to apply the coint function from the statsmodels library to 207 times series with 1397 points each, two by two.
Currently, it takes between 35-40 minutes on my computer with an Intel 24 Cores ...
1
vote
1
answer
41
views
String iteration algorithms performance in jQuery Terminal
I have a JavaScript library jQuery Terminal and I have internal formatting that is used to change colors and style of the text that look like this:
...
1
vote
1
answer
110
views
Finding highly correlated variables in a dataframe by evaluating its correlation matrix's values
I read data from Excel into a Pandas DataFrame, so that every column represents a different variable, and every row represents a different sample. I made the function below to identify potential ...
0
votes
1
answer
163
views
Python Logic Gate Circuit Simulator [closed]
I have recently become interested in simulating logic circuits because of a electronics class at school. I have created a functioning simulator for logic gate circuits in Python. My implementation ...
0
votes
2
answers
151
views
Computation of average speed in Python
someone can help me with this code? I'm trying to compute the average speed every 100 m, starting from a list of spans that contains [distance, time, avg speed].
This is what I've tried to do, and ...
7
votes
2
answers
223
views
Priority Queue (With raise priority operation) using Vector
Here I have implemented a priority queue, with the addition of the raise_priority (also known as reduce key) operation. The reason I have effectively reimplemented std::priority_queue is because the ...
2
votes
2
answers
93
views
For two sequences N and M, display counts of elements n from N below each m from M up to the first n above m
A school's task:
There are two sequences n_tab and m_tab.
For every element m in m_tab ...
6
votes
3
answers
551
views
Feed forward neural network
I have made a basic neural network in python. The idea is the neural network can have any structure you want, not just the standard layers where every neuron is connected to every neuron in the next ...
6
votes
1
answer
273
views
Image stitching using SIFT keypoint descriptor and homography matrix
I have written a code to stitch 2 images using SIFT keypoint descriptor and homography matrix for perspective transform. Are there any areas where code an be improved or optimized?
...
5
votes
1
answer
132
views
string_view tokenizer function template
Below is a function template that tokenizes a given std::basic_string_view using a given delimiter and assigns the tokens to a buffer (via a ...
6
votes
2
answers
191
views
Means square displacement (MSD)
I have written a code to calculate the MSD of some molecules. The code averages over multiple time origins (sliding time window) and over all the molecules. I have also made it do one extra thing: do ...
1
vote
0
answers
93
views
Train a Keras model to recognize and predict speech in real-time using microphone as audio source
Please help me optimize this script. I'm running it in Google Colab GPU runtime. I've implemented many optimizations but they worsened it. I need serious help. I have to submit my project in 3 days!. ...
0
votes
2
answers
44
views
Send sorted, signed requests
This is part of the code I wrote in Java yesterday. It is for sending a body request with some parameters as a pair of keys and values, in a sorted list. Also, this list must have a signature, or the ...
4
votes
1
answer
275
views
2D Minecraft - infinite chunk system
I am making a 2d minecraft clone for a hobby.
Here is my code:
2D_MC.py:
...
4
votes
3
answers
158
views
Summation over different determinants that are independently computed using CUDA
Do you have any suggestions for improving the efficiency of the code below?
I believe that better optimization can be implemented in the GPU function cuKer_sum, which is located in the ...
1
vote
0
answers
114
views
Filtering spatial data based on a distance matrix from large datasets
I am using a R function to spatially filter location points. There are five steps in the function: 1) calculate the distance between all points, 2) for each point, define the number of neighboring ...
5
votes
1
answer
237
views
2d minecraft with infinite chunk system
I've made a python game called 2d minecraft (guess where I got the idea) that has an infinite chunk system. I believe the idea I have is alright but my coding is bad and I have tried to improve it as ...
1
vote
0
answers
71
views
Python script that turns a gigantic text file into an IP geolocation database
I have written a Python script that turns a gigantic text file into a SQLite3 database.
The text file is truly gigantic, it is 133MiB or 140,371,572 bytes in size, and contains 140,371,572 characters ...
3
votes
0
answers
46
views
extracting values from an array of nested objects without duplicates
I have my solution for the below usecase but I would like to know whether is any other effective solution for the same.
My Data:
...
1
vote
0
answers
23
views
LASSO kernel for nonparametric models
I am a novice in nonparametric modeling and have recently begun exploring the world of varying coefficient models. Essentially, these models involve a non-linear least squares problem that relies on ...
2
votes
1
answer
107
views
SIMD Vectorizing C Function Generating Floating-point Range
I have a C function that generates a range from the given start, step_size and end values. I ...
4
votes
2
answers
1k
views
Multi-threading Class in C++
I wrote a C++ class which can take a vector of functions and their respective arguments and execute them in parallel and return a vector of results from its respective functions.
...
1
vote
1
answer
344
views
Comparison of lists of intervals
From the following script, the "similarity" function should be callable to compare two sets of lists and return a certain similarity score. The elements of the lists represent intervals, so [...
2
votes
0
answers
105
views
Cubic spline in cython
For several projects I need a way to use cubic splines inside cythonized functions and since the scipy functions cannot be used within ...
3
votes
1
answer
74
views
Find a solution to a puzzle with tile squares
I wrote a C++ program to find the solution to a puzzle board (a custom puzzle from my school). The puzzle board is made from squares - tiles. On the different tile middle, side or corner there are ...
3
votes
2
answers
295
views
Count matching pairs (modular equality)
Problem
Given an array of natural numbers a. Find the number of such pairs of elements (a_i, a_j), where ...
6
votes
1
answer
357
views
Event manager for games written in C++17
This is a single header event manager that I'm using in my game.
Disclaimer
I ripped everything from these lovely people:
https://austinmorlan.com/posts/entity_component_system/
C++ Event System - ...
2
votes
3
answers
118
views
Convert integer A to integer B using three operations any number of times
You are given a, b and c. You need to convert a to b. You can perform following operations:
Multiply a by c
Decrease a by 2
Decrease a by 1
You can perform these operations in any order and any ...
2
votes
1
answer
161
views
Pre-calculate attacks in a chess game
I'm writing (or at least trying to write) a chess engine in C++. This is the first time I write code in C++, and I use this project to practice. Anyway, I'm following the general guidelines of a ...
1
vote
1
answer
142
views
Large file log parser with less memory footprint
This is a variation of an interesting problem I am currently dealing with. We have a large input file which is being continuously written (size: 10-20G). We need to write a log filter which reads ...
-2
votes
1
answer
110
views
Rubik's cube with simulated annealing [closed]
I wanted to write a c++ program to solve a 3x3 rubik's cube using algorithm named simulated annealing, but failed at it. This idea appeared when I watched this:
https://www.youtube.com/watch?v=...
2
votes
2
answers
61
views
Given a sorted list of integers, find the highest count of elements between an indeterminate but fixed size range
I'm trying to optimize a function that takes a sorted list of integers and tells me what is the maximum number of elements in the list between any definite size range. To be clear, the range itself ...
1
vote
1
answer
133
views
swap two different length group of variable in array
The code below swaps two different-length groups of variables of the same array in the same array.
Is there any other method to achieve this that is less heavy or less redundant?
...
8
votes
2
answers
208
views
Reverse Game of Life
I have written code to take a cellular automaton configuration and determine a state that could have existed one time-step prior, according to Game of Life rules.
The algorithm goes roughly as follows:...