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
3answers
132 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 <...
2
votes
1answer
36 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
73 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
111 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
76 views

PHP function to obtain model_name from Namespace\To\ModelName

Would there be a more clear/efficient way to write ...
3
votes
1answer
42 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 ...
4
votes
1answer
79 views

Optimising iteration and substitution over large dataset

I have the following code: ...
0
votes
1answer
52 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
56 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. ...
3
votes
1answer
106 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 ...
0
votes
0answers
105 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] ...
5
votes
0answers
37 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
118 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
128 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 ...
4
votes
3answers
112 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
96 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
130 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
54 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 ...
0
votes
0answers
24 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 ...
0
votes
2answers
94 views

Descriptive quantity (one, two, many) from number [closed]

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 ...
2
votes
2answers
128 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
108 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
90 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: ...
3
votes
2answers
27 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 (...
1
vote
0answers
25 views

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

I have this 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. The ...
2
votes
1answer
56 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
60 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
55 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
20 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
19 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
76 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
46 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
110 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
29 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 ...
2
votes
1answer
48 views

Python script to find employees who are in one PostgreSQL table but not in another

I'm writing a python script and do database query to get the ids of employees who are in one table but are not in another. I'm using psycopg2 module for python 2 and PostgreSQL as database. After ...
1
vote
1answer
42 views

Data class where i need to set values for different fields at different times

I am creating a request for an api using below class- ...
3
votes
2answers
48 views

I'm reading all lines of another sheet and I paste the value that I want to the active sheet VBA

I have a program that read thousands of lines and return the value that I need. The problem is that request take a lot of time probably like 1min just to search and paste the value, even when I'm ...
2
votes
2answers
83 views

Compare elements of each list of lists to corresponding ones in different list

My goal is to reduce processing time significantly (if possible) by making this working code more efficient. Currently 50k row by 105 column data taking about overall 2 hours to process. Share of this ...
0
votes
1answer
44 views

Is my code fine in the areas of read and write?

What: This is a code that when executed simply writes packet to certain file types. Packet is very simple and contains things like: ...
0
votes
0answers
10 views

Iterating and validating palindromes in pari-gp

My question is if I can improve this code, performance wise? And perhaps also in some other way you can recommend? I just recently have started to try to use pari-gp and am still in the process of ...
2
votes
0answers
92 views

Improving rendering performance of 3D Voxel Game

Improving rendering performance of 3D Voxel Game Technical features added: Perlin Noise Generator 3D Explorable World (You can't break or place blocks) Free camera, you can fly and go through blocks ...
32
votes
3answers
7k views

A* pathfinding algorithm too slow

I'm trying to make a pathfinding algorithm for my project. I need it for a simulation and I need it to be fast!!! I watched a few videos explaining the algorithm online and came up with the code ...
0
votes
1answer
59 views

Django view of reward points that heavily filters and sorts (many) database results

My page (even when it has no data) takes 10+ seconds to load. That's just too long, considering when you finally get to it there's no data. When it has data, it takes even longer. Here is my view, ...
5
votes
1answer
100 views

Coalescing ranges that have the same label

I am working with some data that requires keeping track of different types of ranges. There are three key attributes to keep track of: type (str): the "type" of the range start (int): the value at ...
4
votes
2answers
81 views

Edge detection in a canvas

I have one function in my code to detect edges in a canvas but it's the slowest part of my code and is used everywhere. If I could just optimise this, my whole program would speed up considerably. ...
1
vote
1answer
31 views

tablename alias in attribute name

I have dataframe like this: ...
6
votes
2answers
70 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, ...
4
votes
1answer
113 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 ...