Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
1 vote
0 answers
9 views

Locate Primitive Value in Nested Sequence Type - Iterative version is slower than equivalent recursive function

I'm looking for advice on how to improve the performance and/or style of these two search functions. This is just for fun and for practice: they are already fast enough for any application I would ...
user avatar
0 votes
1 answer
22 views

Show different concentrations on scatter plots with different colors

I have an app which parses data files on the clients browsers and displays a scatter chart. This is an example of a scatter chart with 10,000 data points: This is an example of a scatter chart with 1....
user avatar
  • 211
-1 votes
0 answers
21 views

How to add RMSE to python code? [closed]

I want to add RMSE into the python code. I've tried inserting the rmse code below but i got error only. How do i insert rmse into the whole proper code ? ...
user avatar
7 votes
7 answers
917 views

A probability distribution function, to be called repeatedly during numerical integration

I am trying to speed up as much a possible this function in C++. As I explained in another post, Implementing multidimensional integral for a custom function in C++, this function will be used inside ...
user avatar
1 vote
2 answers
52 views

Hash game in C optimization

I developed this hash game in C for my college, but i need to optimize this code, can you help me? it works well, but I need it to be a little more organized and faster, the rand function is the only ...
user avatar
0 votes
0 answers
29 views

Python function that skews an image while preserving its aspect ratio using affine transformation

See this post for more details. I re-implemented my idea using affine transformations, and finally understood how transformation matrices are formed... Turns out it is stupidly simple, but nothing I ...
user avatar
0 votes
1 answer
73 views

Recursively search directories and their subdirectories for images and videos, except system or locked folders

Search directories and their subdirectories for images and videos, except: Windows system folders, locked folders, and folders selected by me. For example, as a developer I have dozens of Visual ...
user avatar
  • 175
2 votes
2 answers
93 views

VBA functions to calculate sun and moon positions

I have the following VBA code (across three modules) to make UDFs to calculate sun & moon position data. The issue I'm facing is that they are very slow to run as I have over 6000 rows (over 10 ...
user avatar
  • 21
1 vote
1 answer
36 views

Asking for C++ advice based on a radix sort function

Can someone point out what possible edge cases/leaks/inefficiencies my code has and how they could be avoided/fixed. Basically, I want to know what mistakes I make so I can avoid making them in the ...
user avatar
2 votes
2 answers
157 views

Implementing multidimensional integral for a custom function in C++

I am not an expert with C++, but I am trying to implement a 4-dimensional integral using GSL numerical integration approach. The code below shows the whole algorithm. Although it seems correct what I ...
user avatar
2 votes
2 answers
122 views

Generate date_range for string intervals like 09:00-10:00/11:00-14:00/15:00-18:00 and calculate the working minutes

I'm a bit new in python and I'm trying to achieve what I can't with VBA, get things faster. I have large datasets like this in the source(just a sample): This is done also by python and it's a CSV ...
user avatar
  • 178
3 votes
2 answers
73 views

Generate readable English words from given letters

I was redirected from StackOverflow to your community in hope to get some help and improve my script. The script receives letters as input and generates possible words, then extracts readable words ...
user avatar
  • 33
0 votes
0 answers
15 views

Laravel 9 - Metadata creation using middleware?

I wrote a middleware for laravel that grabs the current metadata for the specific URL you visit. How it works: we use the $request and compare the current URL: <...
user avatar
3 votes
1 answer
68 views

Simplify wordle logic Swift

I wrote logic for "Wordle" game but I think it's too heavy and not very readable. Is there any way to improve it? Simple wordle game with conditions: 1) Green colour - "G" if ...
user avatar
3 votes
1 answer
71 views

Add padding to top and bottom of cells

I have a column with variable length text in each of the cells. I have written some code to add padding to the top and bottom of the cells. While the code works well it becomes quite slow when the ...
user avatar
  • 131
4 votes
2 answers
80 views

Multi-threaded Mandelbrot set generator slower than single thread

I am new to parallel programming. I have been playing around with multi-threading and for some reason, multi-threading the Mandelbrot set is slower than running a single thread. I have been trying to ...
user avatar
0 votes
3 answers
63 views

Sum up nested array of objects based on keys

I have this function that should take some array of objects and sum up the values of the inner objects based on some keys, and conditionally add to it some values from another object. Is there a way ...
user avatar
  • 189
0 votes
0 answers
28 views

Ewald summation in Julia

I am writing a small MD (molecular dynamics) engine in Julia and I noticed that 67% of the time spent running the following Ewald summation function (to calculate coulomb energy of an infinite crystal ...
user avatar
2 votes
2 answers
118 views

Find all pairs of natural numbers whose sum is 12

I have been given the following task to complete. I am not sure if my solution is the most efficient. Are you able to take a look and suggest any changes? task: An application that finds all pairs of ...
user avatar
  • 21
0 votes
0 answers
35 views

MTD-F Implementation in Othello

I currently am using the MTD-f algorithm, along with a hybrid negamax/negascout with memory function, in an Othello implementation: ...
user avatar
  • 101
1 vote
1 answer
33 views

Trouble with rendering speed of the animation of a simulation?

The following code is a conversion from some old java I wrote to python. It shows the beginnings of a simulation of an ant colony. I am finding the animation speed very slow - and I'm wondering if I ...
user avatar
  • 155
0 votes
0 answers
40 views

Web-scraping favorites from a website and saving them to an Excel sheet

...
user avatar
4 votes
1 answer
95 views

Arbitrary Length Input in C

From scanf() to fgets(), we need to first specify the maximum length of the string input, due to which input gets a limitation, ...
user avatar
3 votes
0 answers
52 views

Accelerating this stacked matrix-matrix product in OpenCL

I am trying to compute a matrix-matrix product of N stacked complex double N x N matrices. For simplicity, I assume N = 512. I have written code in C++ parallelized with OMP and using OpenBLAS for the ...
user avatar
  • 31
2 votes
1 answer
44 views

Json.Net set the value of the Json object by mixed Json path

Code from: https://stackoverflow.com/a/65715088/6859121 It is use a mixed Json path to set Json value. Even if the object on the path does not exist. This code seems to have room for improvement. Is ...
user avatar
0 votes
1 answer
66 views

Subset Product Algorithm

Subset Product is an NP-complete problem and is my favorite problem. So, I've written a slightly smarter way of solving the problem. Will performance impact matter if I use multi-cpus and my GPU? Do ...
user avatar
1 vote
1 answer
51 views

Infix calculator programming challenge Kattis.com

I'm working on this C++ coding problem: Input is a sequence of up to commands, one per line, ending at end of file. Each command is a definition, a calculation, or a clear. All tokens within a ...
user avatar
0 votes
1 answer
79 views

Fizzbuzz Solution - complexity, readability, performance, lines, obfuscation... - .sort()

The fizzbuzz challenge presents a lot of interesting questions for 'intermediate' programmers like myself. I have found that I don't actually know where to draw the line with, complex (hard to read ...
user avatar
  • 111
1 vote
1 answer
26 views

How to optimize clz count leading zeroes manual implementation?

I have gathered from around the web a few functions and such to land on this: ...
user avatar
  • 299
5 votes
1 answer
91 views

Why is this tensor contraction so slow and how can I make it faster?

I am trying to calculate a specific complicated tensor contraction (of complex valued tensors) which appears as part of some other calculation and is called multiple times in a row, about 100 times or ...
user avatar
0 votes
0 answers
22 views

How to optimize Uint8Array#replace in JavaScript?

I am considering implementing a string type in JavaScript, in a programming language that compiles to JS/Swift/Kotlin/Rust. So I have here implemented a prototype of how the ...
user avatar
  • 299
1 vote
3 answers
143 views

Best way to get an arbitrary property for a C# class?

I have close to a hundred classes where I need to get arbitrary properties from them at runtime. The calling class knows which properties it wants at run time, but not at compile time. Looking for ...
user avatar
  • 176
3 votes
2 answers
97 views

Given a list of digits, construct the largest number divisible by 3

What is the performance of this program? What should I do differently to optimize performance (O(n))? How would you grade it relative to what defines an optimal, elegantly-written program? Input: A ...
user avatar
4 votes
1 answer
89 views

Parsing an IP routing report with half a million lines into a PANDAS dataframe

I have a file that has around 440K lines of data. I need to read these data and find the actual "table" in the text file. Part of the text file looks like this. ...
user avatar
2 votes
1 answer
61 views

Leetcode problem: minimum removal to make valid parentheses

I was working on this problem on leetcode Question Your task is to remove the minimum number of parentheses ( '(' or ')', in any positions ) so that the resulting parentheses string is valid and ...
user avatar
  • 179
21 votes
6 answers
8k views

I created something much faster than a std::string

I've recreated std::string in a way that might be faster. System Features: Much faster than std::string. Easy to use. It was designed as part of a large database ...
user avatar
  • 351
0 votes
1 answer
48 views

Distribute items over array in order to minimize the difference between min and max array values

I came across this problem in a programming challenge a few days ago. I came up with the implementation below, however it resulted in a "time limit exceeded" failure for a few of the test ...
user avatar
2 votes
1 answer
84 views

Replace nested for loops when assigning intial conditions in a 4-dimensional array

I create a 4-dimensional (x, y, z, t) array of zero values. I then set the initial values at t = Tmax. To do this, I use a nested for loop. I attempted to improve ...
user avatar
  • 69
0 votes
2 answers
54 views

Department change management utility

I was wondering on how to make the execution time faster. Is there a way to make it faster with this method or do I need to make with another method? If someone have any solution please help me. ...
user avatar
2 votes
1 answer
74 views

Extract regular words from string but retain all other elements and record their type

This snippet processes every regular (\w+) word in a text and reinserts the processed version: ...
user avatar
  • 1,226
1 vote
1 answer
84 views

Find next biggest palindrome

I have written a program for the SPOJ PALIN problem: A positive integer is called a palindrome if its[decimal representation is the same]from left to right and from right to left. For a given ...
user avatar
1 vote
1 answer
72 views

Checking whether two values are isomorphic in Swift

Working through a book problem Write a function that accepts two values and returns true if they are isomorphic. That is, each part of the value must map to precisely one other, but that might be ...
user avatar
  • 31
3 votes
1 answer
50 views

Quickly read numeric input

Do you have any criticisms or corrections or improvements? I need to read only numbers(and this numbers could be from 0 to 1000000) ...
user avatar
1 vote
1 answer
46 views

Finding the longest prefix among words in a string separated by spaces (Swift)

Solving the problem Write a function that accepts a string of words with a similar prefix, separated by spaces, and returns the longest substring that prefixes all words. Sample input and output The ...
user avatar
  • 31
2 votes
1 answer
85 views

Avoiding nested loops in a TicTacToe algorithm JavaScript

I wrote a quick algorithm that detects a win in a TicTacToe Game. fn game() loops through a simulated ticTacToe board, finds all ...
user avatar
3 votes
2 answers
175 views

Reading big csv file C#

I'm trying to read quite big file with around 28 million of rows in the following way: ...
user avatar
0 votes
0 answers
51 views

Extracting peak and peak width

I have a for loop where I want to read through multiple column of data pull out the peak and peak width data from each column using a predefined function. The loop ...
user avatar
1 vote
1 answer
50 views

performance - Word ladder leetcode

I am working on Word Ladder - LeetCode Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that: ...
user avatar
2 votes
1 answer
60 views

VBA, Data Split Into Two Rows, Convert To One Loop Optimization

I'm trying to convert a data set that is split into two rows into a single row. This was my solution. ...
user avatar
0 votes
2 answers
77 views

Encryption and Decryption in C

I have written a program in C, which encrypts and decrypts a c-styled string (const char *) and print the result to stdout. It ...
user avatar

1
2 3 4 5
170