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
3
votes
1answer
24 views

Parse table names and attributes from SQL queries in a dataframe

I want to get table names and column names from queries in a dataframe. The dataframe is like this: ...
3
votes
1answer
18 views

Converting string of hex values to numpy array of specific shape

I am working on a project that needs to take a .bdf font file and turn it into a Numpy array. I am using the code below to turn the bitmap for the font into a numpy array. It currently works, I just ...
4
votes
0answers
40 views

A straightforward method for computing the Binomial probability mass function

I've been writing up code to test an alternate way of calculating the Binomial probability mass function. The Binomial random variable is the number of heads out of N coin tosses with coins that have ...
1
vote
1answer
34 views

Compare performance of Concurrent Dictionary with Dictionary+Locks

I wanted to measure the performance of Concurrent Dictionary vs Dictionary+Locks in a multithreaded environment. So I created my own SyncDict class of type...
4
votes
0answers
67 views

alternative to std::vector<std::function<…>> which uses tail recursion

An alternative to std::vector<std::function< >> which uses tail recursion to optimize calling the functions sequentially. I'm using this on a real-time ...
1
vote
0answers
14 views

Splitting torch tensor by flags

Working with PyTorch tensors, I need to split the batch of items by its flags, so the items in x_batch_one and x_batch_two are ...
-1
votes
0answers
32 views

VB6 XML Shredder speedup [on hold]

I'm working with a legacy VB6 XML shredder that extracts information from proprietary XML files and loads the information into a SQL Server database. It's working, but it's slow. I'm looking for ...
1
vote
0answers
15 views

Segmented (Bit) Sieve of Eratosthenes in Java

I am trying to create an efficient implementation of the segmented sieve of Eratosthenes in Java, similiar to the one in C found here: https://github.com/kimwalisch/primesieve/wiki/Segmented-sieve-of-...
2
votes
0answers
14 views

.htaccess file to enable compression, send security headers, and set cache expiration

This is the current .htaccess configuration for one of the website projects that I am working on, just as a learning exercise. This is working code and everything in it seems to be ok, My hosting ...
-1
votes
2answers
61 views

Project Euler problem # 3 is this the most efficient approach in Python or can I do better?

The problem statement: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? This code takes 9 seconds!, is there a better way? ...
2
votes
3answers
120 views

Modeling, view and projection transformation using vector and point in homogenous form

I know this is horrible code. This program is for performing modeling, view and projection transformation. The program reads input from scene.txt and outputs the <...
-1
votes
0answers
17 views

Optimizing a for loop in R [on hold]

I have written the following code bit which incorporates nested for loop. Will appreciate help in optimizing the code for faster execution. ...
2
votes
1answer
26 views

Beautifulsoup and lxml (xpath) too slow with respect to regex when parsing HTML

I agree that using regex to parse HTML is not a good way, in particular I am worried about their fragility with respect to change in the HTML. The problem is that any alternatives are really too slow....
1
vote
3answers
63 views

Optimizing primes generating program in C++

I am writing a program to generate primes in range 1 upto 10^9 but it seems to be timing out. It implements the Sieve of Atkin I have tried optimizing my code using bitsets and pragmas. Please are ...
2
votes
2answers
107 views

Performance issues with double for loops, EM-algorithm

The alpha that I create is not created in a crazily efficient way I know, but the main bottleneck in this code is in what I call the "Maximization step" (see comments in code). There are double for-...
1
vote
5answers
56 views

PHP function to obtain model_name from Namespace\To\ModelName

Would there be a more clear/efficient way to write ...
1
vote
0answers
24 views

Find a Sum of Particles in A Set of Boxes Given a Number of Rows and Columns

This is a code challenge, from Codewars, the details of the specific challenge in depth can be found here: https://www.codewars.com/kata/magnet-particules-in-boxes/javascript. The summary of it ...
0
votes
0answers
62 views

How to reduce the complexity of this O(n^3) code [closed]

Here is the piece of code that's bothering me. It does the task but I want to optimize it if possible. I have list of Entities ...
4
votes
1answer
69 views

Optimising iteration and substitution over large dataset

I have the following code: ...
0
votes
1answer
50 views

Nested list performance tuning

I need to make a function like these two, but at least an order of magnitude faster in python. Any tips or tricks? These functions inputs are nested lists, like: ...
-2
votes
1answer
51 views

Bodyless Self-Closing *for* Loop [closed]

I use self-closing bodyless for loop to quickly find an element within an array or collection. Learned it from a Java teacher. But I'm seeing warnings on certain IDEs that have a code inspection tool. ...
2
votes
1answer
58 views

Find A Series of Numbers Who when Squared and Summed are equal to a given Square

I am working on a CodeWars titled 'Square into Squares. Protect trees!' it can be found here: https://www.codewars.com/kata/54eb33e5bc1a25440d000891/train/javascript I have a working solution, the ...
-3
votes
1answer
54 views

Avoiding loops in a R code to optimize it [closed]

I have some troubles with a code which take a huge amount of time to run. Could someone give me some help? Thanks in advance! ...
0
votes
0answers
88 views

Minimum sum of elements, taken 2 at a time

Update: I had not recalled the question correctly and ended up with the wrong question. I have now updated the question and the solution: The question is: Given an array of integers say [8,4,6,12,10] ...
4
votes
0answers
32 views

Border Radius Preview Tool

I am running through an app idea to help improve my knowledge of Javascript. The code attached performs the following: Performs a regex on the input field to check it is value 0-9 If not, it clears ...
1
vote
1answer
77 views

Two solutions to 2-sum

I have written a solution for two sum problem in variation. first is simple with two loops and another one is one loop and hash map. But I wonder why the simple solution is faster than the efficent ...
4
votes
3answers
2k views

Palindrome test

This is some code that determines if a string of characters is a palindrome or not. My professor says that there is a performance issue with the program, but I can't quite put my finger on it. Can ...
3
votes
1answer
100 views

Simple sharding of delimited files to more sophisticated

A while back I came across the issue of having a large delimited file where I wanted to simply parallelize my python code across each line of the file. However, doing so all at once either took up too ...
3
votes
3answers
84 views

Fast-resizing uint8 buffer

I wanted a buffer like std::vector<uint8_t> which is very fast at resizing, and it does not require byte initialization (it resizes to 16K, then to 2-4 bytes, ...
1
vote
1answer
51 views

HackerRank Code “Determining DNA Health”

I am working on this problem: https://www.hackerrank.com/challenges/determining-dna-health/problem passing some test cases and time-out on others (no wrong answers). The code is here: ...
3
votes
2answers
90 views

Jump Game - Leetcode

Below is my solution for the LeetCode Jump Game Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents ...
3
votes
2answers
45 views

Finding paths between triangles efficiently in 3D geometry #2

This post is an update of the one from here. I've updated the code and a couple pieces of the post itself. I've been writing some functions used to find paths between two types of triangles - alphas ...
-2
votes
0answers
34 views

Optimizing a complex list in C# [closed]

Need to improve the while loop performance. In my code I'm using for loop and create new instance for every loop. It takes around 25s to complete. How to boost the performance? Here is my code snippet:...
0
votes
0answers
21 views

First project using SCSS - A brochure website for a restaurant

I recently completed my first website using SCSS and thoroughly enjoyed using it over plain old CSS even though I didn't get use any of the advanced features of SCSS. I figured before I delve into ...
1
vote
2answers
87 views

Descriptive quantity (one, two, many) from number

I just write a simple method which returns a string based on the number in accepts as a parameter. I used if/elif/esle here but I think for this simple scenario I ...
1
vote
2answers
117 views

Run length encoding in C#

This is the original question: https://www.geeksforgeeks.org/run-length-encoding/ Given an input string, write a function that returns the Run Length Encoded string for the input string. For ...
3
votes
3answers
102 views

Finding paths between triangles efficiently in 3D geometry

An update to this post can be found here I've been writing some functions used to find paths between two types of triangles - alphas and betas. Alphas are triangles that have been in a zone we ...
2
votes
2answers
83 views

Check whether a string has all unique characters (time efficiency)

I don't find this algorithm in Go language here, so I just want to check that it is really most efficient algorithm in Go: ...
2
votes
1answer
18 views

git Create Tree from Arbitrary Directory (works in bare repository)

I made a script for a project I'm working on to create a tree object from a filesystem directory, without any working tree operations (can be run in a bare repository). The tree can be inserted into (...
0
votes
0answers
19 views

Stored procs fine tuning for processing bulk data - 5 million records

I have the below procedure which is used for bulk upload data from a temporary table (temp_rules_master) into two other related tables. It has 5 million records. ...
2
votes
1answer
51 views

Loop to copy values from one sheet and paste the values 68 times in another, time efficiency

I have created a large VBA program to automate creation of a data table that is needed to run slicers in an Excel file. While the loop works well in creating what I need, the main loop take an hour to ...
4
votes
1answer
57 views

Comparing objects in a list against each other

I have a list of ~27000 objects. Each object represents a line from a file where each line is one record of a measurement from some instrument. The most import aspects of the object are: Instrument ...
3
votes
1answer
40 views

Calculating all flight connections

I am working on an API to return all the possible flight route between point A and B. I have a set of data which includes the flight number, airline, departure airport, destination airport, ...
1
vote
0answers
18 views

Merging partial objects while avoiding path collisions and ordering array indexes

I have been creating a small library to copy parts of deeply nested objects through path strings that supports wildcards. For that I list all paths and values actually found as ...
0
votes
1answer
15 views

Querying nearest city with a given shop using latitude and longitude is slow

I am using the following query to search for the nearest city to my location from the cities table using latitude and longitude. The query also checks whether the nearest cities to my location have ...
17
votes
5answers
4k views

Speeding up thousands of string parses

I have a mapping application which takes string arguments in the form of string arrays. I parse these and then perform an action on the map. One of these is ...
2
votes
3answers
69 views

Faster output to Sheet from a collection of Dictionaries

My code is currently offloading parsed data into multiple spreadsheets, but it's pretty slow: about 110k rows and 35 columns in 3.5 minutes. I was wondering if there were a more efficient way of ...
4
votes
2answers
44 views

Simple spatial grid for particle system

I am going to simulate a particle system, the particles are infinitesimal points which apply forces on the neighbors and I need a fast way of making proximity checks, they are going to have a maximum ...
3
votes
3answers
96 views

Thread-safe “singleton” that destroys object when not used anymore

I'm working on some legacy code which uses the singleton pattern. The problem I have with the traditional singleton is that the instance lives until the program terminates. This is messing up the ...
1
vote
1answer
24 views

React - Bottleneck Textinput / Filtering

I've got a big react app (with Redux) here that has a huge bottleneck. We have implemented a product search by using product number or product name and this search is extremely laggy. Problem: If ...