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,703
questions
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
134
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
209
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:...
1
vote
0
answers
62
views
Appending data from files listed in a file
I am working on a project that requires me to write VBA code which, upon a button press, loads the data from certain files in a given directory.
In my testing, I was able to load the data from 1100 ...
3
votes
0
answers
467
views
Tauri/Rust small program to upload files with use of threads and openssh
First time I'm using Rust in one of my programs and I feel a lot can be improved. I don't have any colleagues / friends that already used Rust so this is the only way to get some validation that it's ...
4
votes
2
answers
469
views
Solving The Travelling Salesman Problem Using Genetic Algorithm
I was looking to learn about AI and found the traveling salesman problem very interesting. I also wanted to learn about genetic algorithms, so it was a fantastic combo. To clarify, this is my second ...
1
vote
1
answer
222
views
Implementing a 1D Convolution SIMD Friendly in Julia
I want to implement a 1D convolution in Julia using the direct calculation since the conv() function in DSP.jl uses DFT (fft) ...
5
votes
2
answers
123
views
concatenate values and delete the remaining rows using arrays
the below code used to:
Concatenate the values on a specific column "N" depend on the value of column "A" then delete the remaining rows.
It works, but with range of 30k rows the ...
4
votes
1
answer
105
views
CUDA kernel to compare pairs of matrices
My first time writing anything significant in CUDA.
This kernel takes two arrays representing square matrices and compares them pair-wise. It takes into consideration large input arrays, and ...
1
vote
1
answer
180
views
Collecting hashes of all files in a folder and its subfolders into a dictionary in Python
What I am doing here is iterating through all the files in the parentFolder and its subfolders collecting all the hashes of all the files and putting them into a ...
0
votes
1
answer
119
views
Noise dosimeter in Python
Seems to work. I'm looking for tips on how to speed up the program.
Tried: Running without GUI (a little faster but not as I wanted)
Severity: terrible (one update per 400 ms, no wait time included) ...
4
votes
4
answers
1k
views
Matching words from a text with a big list of keywords in Python
I implemented the following code to retrieve medication names from a given text (prescription_text in the code). It works by matching words in the text with a list ...
10
votes
2
answers
2k
views
Getting all combinations of an array by looping through binary numbers
I need to loop through all possible combinations of an array for a project I'm doing. I'm doing this by looping through all integers in binary from 0 to ...
4
votes
1
answer
321
views
Multithreading a shortest path algorithm
I would like to modify my shortest path finding code to use multithreading and improve its performance. The algorithm must be able to work with negative weights, and as a result, we cannot use ...
1
vote
2
answers
244
views
Count the number of ways N queens can be placed on an N✕N chess board
The n-queens puzzle is the problem of placing n queens on an n✕n chessboard such that no two queens attack each other.
Given an integer n, this code returns the number of distinct solutions to the n-...
1
vote
1
answer
71
views
SYMGS implementation in CUDA
I've been asked to implement one iteration of the Symmetric Gauss Seidel on CUDA.
I was given the CPU implementation for Sparse matrices in CSR and the goal to speed it up using the GPU.
Below is my ...
0
votes
1
answer
118
views
Generate HTML from input fields
I am building a small tool to generate a copy and paste HTML block, based on the user inputs.
In the HTML file, I have all my inputs (select, checkbox, text inputs etc).
I based myself on the JS of an ...
2
votes
1
answer
168
views
Deletion of nodes of degree <=1 from a Python igraph graph
I have a working way of deleting all vertices of degree less than 2 in a graph until no more can be found.
But my solution has a significant issue which is that it calls ...
6
votes
2
answers
2k
views
Game of life(random generation)
I wrote a simple game using python, but I wonder: how I can improve it? Any opinions will be useful.
I thought about optimization, since the program consumes 20% processor resources, but don't know ...
-2
votes
1
answer
70
views
Moving increments into condition checks? [closed]
I am reading the second edition of the C Programming Language by Kernighan and Ritchie. In it, the authors introduce things like:
...
3
votes
1
answer
350
views
Fast approximate sin/cos function in Rust
Over the past month or so, I’ve been trying to create an extremely fast, platform agnostic, auto-vectorizing sin/cos function for fun. I initially started with sleef-rs’s fast sin function, and ...
6
votes
2
answers
266
views
Bellman-Ford optimisation in C with Shortest Path Algorithm (SPFA) and Small Label first (SLF)
I am trying to code an optimized version of Bellman-Ford algorithm. This post is a continuation of the following post Bellman-Ford optimisation in C in which I posted a first version of the classic ...
4
votes
1
answer
296
views
Transcoding UTF-8 to UTF-16-LE in VBA
VBA is a language that's lacking a lot of basic functionality. (Pun intended)
Most libraries, if they exist in the first place, are OS-specific, and even some of the inbuilt functions don't work on ...
2
votes
3
answers
474
views
Recursive palindrome check
I'm trying to solve this which basically calls for a recursive palindrome check with some minor extra steps (Special characters and whitespace can be ignored). The test inputs' length can be 100000 ...
6
votes
2
answers
2k
views
Bellman-Ford optimisation in C
Here is my current code:
...
3
votes
1
answer
182
views
Damerau-Levenshtein distance performance improvements
I am working on a Python C-extension to calculate Damerau-Levenshtein distance. I am not really familiar with C at all--I just know that it generally has better performance. However, I am not sure how ...
1
vote
1
answer
67
views
Counting Ads in webpage using XPath and EasyList in Python
I have the following the function the retrieves a given webpage and returns the number of adverts that are on the page using a shortened version of EasyList (17,000 rules). Using multiprocessing, this ...
8
votes
2
answers
478
views
Fourier Series of a given function
This is a very simple code that expresses a function in terms of Trigonometric Fourier Series and generates a animation based on the harmonics. I would like to know some ways to improve the ...
-1
votes
1
answer
87
views
Optimize this Python Code
See the following equation:
I have made the following code for it:
...
0
votes
1
answer
69
views
Optimize system of equation function organizer with memory bottleneck in python
The Code
So i have the following function that just gathers a system of equations so it can be input into the standard solvers of scipy
...
1
vote
1
answer
581
views
password crack dictionary
I am very new to coding and I just jumped in and am trying some things.
I have been using the following code to create a password dictionary to crack wifi passwords with brute force but it will take a ...
0
votes
1
answer
74
views
Longest Palindromic Substring: solution is not optimized
I decided to write a solution for the Longest Palindromic Substring using more declarative (IMO) style as opposed to a C-style code.
One of C++'s idioms is "zero-cost abstraction", so I ...
4
votes
3
answers
155
views
quadratic probing hashmap and its time efficiency
I am writing small a hashmap library (not full featured yet) but I have some questions about the algorithm I wrote, the formula I hope I got right from wikipedia and general things.
Measured ~14.3 ...
2
votes
1
answer
226
views
Finite difference estimation of partial derivatives for arbitrary grids in python
I am currently working on testing some codes on python to solve differential equations by finite differences, but some problems and equations i am dealing with are:
Too big to keep manually writing ...
0
votes
0
answers
30
views
Building an Org Chart
I have 2 data sets, a list of organizations and a list of personnel. The code consists of a sort for each to put them in order by organization, then add the personnel to each organization as child ...
1
vote
1
answer
51
views
A recursive_transform Template Function with Calling reserve for Performance Improvement
This is a follow-up question for A recursive_transform Template Function with Unwrap Level for std::array Implementation in C++. Following the suggestion mentioned in G. Sliepen's answer, the function ...
3
votes
1
answer
145
views
Find factor pairs of an integer in Rust
I'm trying to efficiently generate all pairs of factors of a number n.
For example, when n=27, the factor pairs are (1, 27), (3, 9), (9, 3), (27, 1)
The order in which the pairs are found is not ...
0
votes
1
answer
63
views
Performance Optimization in Matlab
I am working with a rather large data set (upwards of 1 million entries across 3 variables), and need to isolate a subset of that data with specific values in one of the 3 data fields. The data are ...
1
vote
1
answer
106
views
Reviews a daily fantasy slate to check for duplicate lineups
My code below is used as a back testing tool to review a past Daily Fantasy Sports slate. This code works perfectly but when the contest size (total entrants) gets up to the 30,000 range it takes ...
2
votes
1
answer
109
views
Update an Excel master workbook with values from new workbook
I have a master .xlsx file on which other spreadsheets depend. Each week, I export a new .xlsx file (from MRP) that may or may not be the same as the master. The columns are always identical. Rows may ...
4
votes
1
answer
175
views
Vectorized 16-bit addition in Standard C
The idea is to add a given 16-bit number N to each element of an array of 16-bit integers of arbitrary length, taking advantage of 64-bit integer types and instructions to perform the additions 4 at a ...
1
vote
0
answers
86
views
USACO Silver "Wormhole Sort" solver
I'm struggling a bit with a USACO silver question using python, http://usaco.org/index.php?page=viewproblem2&cpid=992.
The question provides an unsorted list of numbers (cows) and a number of ...
2
votes
2
answers
272
views
Calculate the price of fruits in a trade (for a game)
I'm making a calculator that is supposed to calculate the price of fruits in a trade (for a game)
omg, my code is so bad and messy that its embarrassing. I'm so sorry for anyone who has to look at ...
2
votes
1
answer
124
views
DFS Maze Solver
I am new to Rust Programming so I decided to implement a Maze Solver using DFS. I was wondering if there is any way to optimize this code further
...
3
votes
1
answer
103
views
A singly linked list implementation
Here's yet another implementation of a singly linked list. You may base your review on the following questions:
Review goals:
Is the API well thought of?
Does this design include undefined behavior, ...
0
votes
0
answers
75
views
Walk a folder of files and extract creation date, countries mentioned and a summary based on their text for each
I made a script that scans a folder of 723 documents (pdf, pptx, docx) to extract the 'Name', 'Type', 'NbPages', 'Creation Date', 'Period Date', 'Countries', 'Summary', 'Indicateurs', 'Path'. I think ...
1
vote
1
answer
67
views
Leet Code: 127. Word Ladder (Part 2)
Original Question:
Leet Question
A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such ...
2
votes
2
answers
312
views
Leet Code: 127. Word Ladder
Leet Question
Update Leet Code: 127. Word Ladder (Part 2)
A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -...
3
votes
2
answers
114
views
Custom-made spellchecker with Wiktionary
I have been coding on Python for two weeks.
All I want the code to do is this:
Check if each word in sentence has an English category Wiktionary article
Ignore all words inside quotations and proper-...
-4
votes
1
answer
150
views
matrix multiplication in C++ [closed]
I have the following function that takes too long to execute.
I need to made this at least 2x times faster.
...