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.

Filter by
Sorted by
Tagged with
2 votes
0 answers
70 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 ...
-4 votes
0 answers
27 views

Shrinking my pygame draft creating acceleration for sprites when a key is pressed [closed]

I did a test program that simulates acceleration of a sprite when the key is pressed the velocity increases until a max speed is reached. When no key is pressed a slow deceleration is occuring. The ...
  • 1
6 votes
2 answers
198 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 ...
  • 111
4 votes
1 answer
82 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 ...
  • 155
2 votes
3 answers
406 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 ...
  • 125
5 votes
2 answers
2k views

Bellman-Ford optimisation in C

Here is my current code: ...
  • 111
3 votes
1 answer
113 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
35 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
395 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 ...
  • 83
-1 votes
1 answer
63 views

Optimize this Python Code

See the following equation: I have made the following code for it: ...
  • 99
0 votes
1 answer
62 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 ...
  • 113
1 vote
1 answer
71 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
64 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
116 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 ...
1 vote
1 answer
80 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 ...
  • 113
0 votes
0 answers
29 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
48 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,758
1 vote
0 answers
75 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 ...
  • 73
0 votes
1 answer
49 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
1 vote
1 answer
63 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
71 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
129 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
43 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 ...
  • 11
2 votes
2 answers
131 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 ...
  • 31
1 vote
1 answer
55 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 ...
  • 11
2 votes
1 answer
80 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, ...
  • 807
0 votes
0 answers
46 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
50 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 ...
  • 92.9k
2 votes
2 answers
211 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 -...
  • 92.9k
3 votes
2 answers
93 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-...
  • 133
-4 votes
1 answer
92 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. ...
1 vote
1 answer
36 views

Match an array of date strings to the current calendar selection

I have an input array of month-year strings of disabled months selected by the user: ...
2 votes
1 answer
57 views

Detecting timeouts in a stream of events

I'm trying to come up with a solution to this interview question: You have a stream of RPC requests coming into a server which is being logged. Each log entry is of the form [id, timestamp, type ('...
1 vote
1 answer
21 views

Performing analytics on access.log with Bash

Before I learned that GoAccess was a thing, I wanted an analytics solution that I could use locally on my web server. My solution was to write a bash script that would give me some basic info on how ...
0 votes
1 answer
57 views

Training a Reinforcement Learning algorithm

Problem: I'm trying to reduce the computation time and optimize specific functions of a Reinforcement Learning algorithm in the training phase and observed that one block of code takes too much ...
1 vote
0 answers
86 views

Making Robert Tarjan's offline LCA algorithm run (much) faster (Java)

I have produced this GitHub repository that compares the performance of: Robert Tarjan's off-line lowest common ancestors algorithm, An improvement of the above algorithm. Typical demo program ...
  • 26.5k
4 votes
5 answers
554 views

Sort a vector containing only three distinct values

I have a program that sorts the vector containing only 0,1,2 in the sequential order so the input array of [0,2,1,2,1] would generate an output ...
  • 458
1 vote
0 answers
15 views

Updating the log-density of a multivariate probit latent class model

I am new to Rcpp and am looking to make the following code as fast as possible. Any tips would be greatly appreciated. It is running a lot slower than I would like. I have tried vectorising as much as ...
  • 11
1 vote
1 answer
40 views

to capture packets with options like -i interface, -o open file, etc using pyshark and python

review my code if possible. I am making network packet capture using pyshark and python. if possible give me some feedback about the code and help to make it better. ...
2 votes
1 answer
56 views

Powershell file parsing

I am using Powershell 7. We have the following PowerShell script that will parse some very large file. I no longer want to use 'Get-Content' as this is to slow. The script below works, but it takes a ...
  • 285
2 votes
2 answers
152 views

Quick Sort Program

Quick sort is a sorting algorithm in which we select any random element as pivot from the array and we do the partition of the array around that pivot. Basically we place all the elements smaller than ...
1 vote
2 answers
102 views

Logistic regression using gradient descent

My code seems to work fine, but I'm interested in how I can make it faster. I really just want to reduce any wasteful computation (for instance ...
1 vote
1 answer
58 views

Group uncorrelated variables into subsets using correlation matrix

I am trying to group uncorrelated variables into subsets. So, using the correlation matrix, I check each variable to see the correlation. If correlation is more then a threshold I will create a new ...
  • 13
1 vote
1 answer
108 views

Text to image steganography

This simple implementation hides text secrets (S) in images by manipulating the least significant bits (lsb) on Pixels. How it works When encrypting I take a three pixel "chunk" for each ...
3 votes
1 answer
104 views

Solve an option pricing PDE in Python - Part 1 [closed]

The Github repository NM-Heston solves call option prices under the Heston 2-factor model using ADI splitting schemes. I am adapting the code to price options under the 3-factor Heston-Hull-White ...
  • 111
1 vote
1 answer
55 views

calculating the percentage of distribution of ids per Loc for each country

Which of the two queries is theoretically better and why? I would like to understand why query 2 takes longer although there is no relevant information in the Execution Plan. I'm querying a Presto ...
7 votes
4 answers
852 views

Calculate average values for each day of the week for each Meter

I have a program with these two methods. One method to import a set of data from a CSV within the given time period and store them in a dictionary. Here the data in CSV file is stored in following ...
0 votes
0 answers
107 views

Program to generate a tree of permutations

There is a computation I'm doing with permutations (permutations of varying length of an entire interval [1,N] for some N) in python that I feel could be faster. ...
3 votes
1 answer
31 views

Python script copying specific table data from multiple docx files into an XLS file

The code copies the second column from the right of all the docx files' tables from the folder where the py file is saved, and does some editing on the content in specific cases. The problem that it ...
5 votes
1 answer
81 views

Prune unreachable sections of a directed graph

I have a graph represented with an Adjacency set similar to: ...

1
2 3 4 5
152