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.

3
votes
0answers
6 views

Sums of all sublists

The parts_sums function in the code takes a list as parameter and then returns sum of all sub-lists present in the list. e.g. if, ls = [1, 4, 6, 4] then ls contains, ls = [1, 4, 6, 4] ls = [4, 6, 4]...
3
votes
0answers
32 views

Factorial calculation UI freezes on loading many items in ListBox

I've been experiencing this performance issue for about 3 days and really need your help. I'm a novice at c# and cannot understand what I can do to optimize my application. The problem is that the UI ...
2
votes
0answers
26 views

Difference distribution table for DES

This is my DDT (for DES) code. I just wonder how to be more efficient... I've just started cryptography and I'm not good enough. ...
3
votes
1answer
36 views

Left or right padding a string with the specified character

Can I improve performance of below method? Is there anything I need to optimize or any redundancy I need to remove to make it more efficient? It's a simple method used to pad strings by left or right. ...
0
votes
1answer
43 views

Miller-Rabin Large Prime Generator in Rust

I implemented the Miller-Rabin prime test in Rust and made a program to generate large primes. I have also implemented the same program in C and Haskell and the Rust version is the slowest. I am ...
1
vote
1answer
28 views

Efficient way to get value from a dataframe and append new dataframe

I have a dataframe that have about 200 million rows. the example of dataframe is like this: ...
-2
votes
0answers
27 views

How i get the high performance for this program

I have some problem about the result, the result run slowly and get the "Memory Error" for large data ...
1
vote
1answer
14 views

Batch retrieve formatted address along with geometry (lat/long) and output to csv

I have a csv file with 3 fields, two of which are of my interest, Merchant_Name and City. My goal was to output multiple csv ...
0
votes
0answers
26 views

Clustering using k-medoids

This is the program function code for clustering using k-medoids ...
1
vote
1answer
36 views

Copy-Pasting (kind of) from Excel to an existing Word table

What I'm trying to do here is to open an Excel file and then search for and store the data I need (i.e if there is a reference then I copy 2 columns). Afterwards, I paste or write that data into a ...
2
votes
2answers
45 views

SQL log file parser

I have a read log file function to get select operation from database log file like this: ...
1
vote
0answers
24 views

Sortings stocks into quantiles based on their signal

This function sorts stocks into quantiles. To do so I used this function that accepts sig_df (dataframe with the timeseries of stocks signal) and number of ...
-1
votes
0answers
49 views

Sobel filter for edge detection

I've tried to implement my own Canny edge detector and tried to make it as fast as possible. I tried to code most of the needed function myself and only used opencv as input/output. However, the ...
0
votes
1answer
25 views

Optimize code for a grid of radio buttons in Android

I want to display multiple radio buttons in a layout with multiline style as an item inside a RecyclerView. Look at the code I provided below and suggest how I can ...
3
votes
2answers
84 views

Sum of primes up to 2 million using the Sieve of Eratosthenes

I've solved question 10 on Project Euler using the Sieve of Eratosthenes, what can I do to optimize my code? ...
2
votes
1answer
33 views

Efficient resampling of time series

I'm trying to create an efficient function for re-sampling time-series data. Assumption: Both sets of time-series data have the same start and end time. (I do this in a separate step.) Resample ...
5
votes
2answers
664 views

Printing a multiplication table in C [on hold]

I'm a complete beginner, but I'd like to learn how to program. I really started 2 weeks ago. So I tried the common exercise, aka the multiplication table, but I tried to add little things I learnt ...
-1
votes
0answers
26 views

C reoganize code in order to have 2 function [closed]

I have the following code (that perfectly works) however I would like to make it more readable. Idealy I would like to cut it into 2 function. ...
5
votes
1answer
75 views

Sodoku solver with arrays of bitsets

I wrote a quick sodoku solver as an exercise and am curious how to make it faster. Parsing and printing is largely irrelevant only there for readability. How can I make the code cleaner and faster? <...
11
votes
3answers
2k views

Prime sieve in Python

I was trying to write Sieve for the first time and I came up with this code: ...
1
vote
1answer
93 views

Performance issue with empty lists

Here's my updated version of the problem I posted at Calculating time windows for entities, adding in suggested changes as well as a change I did so that the Reflection is 'cached' in a ...
3
votes
1answer
61 views

Deduping files using hardlinks

I'm trying to organize my gallery, and I have certain folders rife with copies. My daily work is mostly javascript and php, being your generic web developer. However I took this as an opportunity to ...
8
votes
2answers
782 views

Primes and SemiPrimes in Binary

I'm in the midst of re-learning python. My current effort is an implementation around prime factorization. I am attempting to reproduce something similar to the table found here (in binary): https://...
5
votes
0answers
36 views

Tensorflow loop to analyze gradients derived from MRI and PET images

The code shown below takes the partial derivative of each pixel of the output fused image of a neural network with respect to input image of the neural network using tensorflow's ...
-2
votes
0answers
44 views

Looping through this list takes time [closed]

Below is the function which takes in list containing 3million elements and then creates another dictionary out of it for further lookups. This is an extremely time consuming function which after ...
5
votes
1answer
170 views

Scraping an parsing jockeys data using Task.Run

I started to have HUGE doubts regarding my code and I need some advice from more experienced programmers and architects. On the button click, the application runs a method, that is running a ...
10
votes
3answers
1k views

Find the common ancestor between two nodes of a tree

Here is my code in Python for to find a common ancestor between two nodes in a particular tree. This is a question from Cracking the Coding Interview that I decided to implement on my own. No one has ...
2
votes
0answers
31 views

Spiral printing elements of a matrix

As I'm learning elixir, I wrote some code for printing elements in the spiral of a matrix(2D array). I was wondering if there is any room for improvements with regards to its performance or ...
2
votes
2answers
255 views

Regex version of strip() - Ch. 7 Automate the Boring Stuff

Here is a practice exercise — Regex version of strip() \$-\$ Write a function that takes a string and does the same thing as the ...
5
votes
2answers
346 views

Fantasy game inventory — Ch. 5 Automate the Boring Stuff

Here is a practice exercise — Fantasy Game Inventory \$-\$ You are creating a fantasy video game. The data structure to model the player’s inventory will be a dictionary where the keys are string ...
3
votes
0answers
40 views

msmq bulk send in c# [closed]

Please review the code below and provide constructive feedback to improve. Multiple threads call the SendMessageToMSMQ method to send messages to a msmq queue. ...
4
votes
1answer
51 views

Java Mandelbrot Set Viewer

I'm writing my own version of a Mandelbrot set generator, with pan and zoom functionality. (There's not yet a color overlay of sets generated with various beta values; the beta value is changed ...
3
votes
0answers
78 views

Alternative for VLOOKUP/Index-Match in VBA

I am sharing this function I wrote with the community to provide an alternative to slow VLOOKUP and/or Index-...
4
votes
1answer
50 views

Collecting all relevant data from xlsm files

Is there a way to speed this guy up? The code is designed to go into a directory, open up all of the .xlsm files in the folder, and copy specific data into a target file. This code works as is, but it ...
0
votes
2answers
67 views

(Leetcode) Valid parentheses

This is a Leetcode problem - Given a string containing just the characters '(', ')', '{', ...
6
votes
2answers
78 views

Positive cumulative sum of difference

I have a water reservoir with input and output rates. I want to determine when the input is exceeding the output by a certain constant. To accomplish this, I need to cumulatively sum all cases where ...
3
votes
1answer
77 views

Most efficient way to check if user is allowed to update an object

So I have an user which can create his own Locations. I implemented a webservice in order to add and update locations. If the user is not the owner of the location i want to throw an appropriate ...
1
vote
2answers
43 views

Leetcode 15 - 3 sum

This is a Leetcode problem - Given an array nums of n integers, are there elements \$a, b, c\$ in ...
2
votes
1answer
28 views

Whiten black contours around a skewed image

I have this image: I want to whiten the black contours (borders) around it without affecting the image content. Here is the code I used: ...
3
votes
0answers
40 views

Strongly Connected component algorithm implementation(Python)

My goal is to implement Strongly Connected Components algorithm using python. I have splitted up my code on 3 parts: Data Load: ...
7
votes
2answers
459 views

Word-Ladder solver in Python 3

Follow-up to Python program to find a word ladder transforming "four" to "five" I'm trying to write a program to solve a word ladder puzzle to brush up on my Python. For those who ...
3
votes
0answers
29 views

(Leetcode) Snakes and Ladders

This is a Leetcode problem - On an \$N\$ x \$N\$ board, the numbers from 1 to N * N are ...
5
votes
0answers
48 views

SQS subscriber pattern in background service

I have the below code to pull messages from a FIFO SQS queue. Using the while (IsRunning) loop makes me feel to question the code design. Is there a pattern I am ...
4
votes
1answer
74 views

Two ways of implementing a combat system

Below is a segment of a game I am writing to stay in practice with my Java. EDIT The class this method is in is the Encounter class. This class just manages the encounter between the player and an ...
4
votes
4answers
150 views

Find the nth term of a sequence that consists of Fibonacci and prime numbers interleaved

I have given a series problem 1,2,1,3,2,5,3,7,5.... in which the odd terms forms the Fibonacci series and even terms form the prime number series. I have to write a code in which I have to find the ...
2
votes
1answer
42 views

Select optimal piecewise regression fit

I'm making a program which fits a piecewise linear regression with up to 4-5 breakpoints in the data, and then deciding how many breakpoints is best to prevent over and underfitting. However, my code ...
3
votes
1answer
59 views

Most efficient way to loop through files using VBA Excel

I have a procedure for looping through all files in folders and subfolders starting at a folder which the user can select. The user can select both the source and target folder. I'm using Excel VBA ...
2
votes
1answer
60 views

Generating and storing a unique salt in Oracle database using Java

This is my account table: ...
4
votes
1answer
54 views

Pick the best combination of n choose k models

Algorithm Let \$M_0\$ denote the null model which contains no predictors. This model simply predicts the sample mean of each observation. For \$k=1,2,\ldots,n\$: Fit all \$n \choose k\...
3
votes
2answers
62 views

Optimizing Luhn check digit algorithm

The internet as a whole and Code Review in special already provide a decent amount of implementations of the Luhn check digit algorithm. They often follow a relatively "naive" strategy, in that they ...