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
0answers
17 views

LeetCode: range sum query mutable c#

https://leetcode.com/problems/range-sum-query-mutable/ I am trying to solve this question using dynamic programming. I guess the guys in leetcode want to limit us to use segment tree or one of the ...
1
vote
3answers
68 views

“Digit Queries” CSES Solution giving TLE

I really need a more accurate way to size inf_string. This code works but gets exponentially more inefficient the bigger max(queries) is, and therefore just can't hold up to the gargantuan numbers ...
0
votes
0answers
7 views

scatter subplot for iris dataset

I'm new to data science. I wrote this script for plotting all different kinds of iris data set scatter plot. trying not to plot something with itself . how can I optimize my code ? ...
0
votes
0answers
15 views

Fast bruth force numpy array combination

I want to extract combinations of numpy arrays in that way: ...
0
votes
0answers
24 views

function to check if anchor tags contain href attributes with 301

I made this function to test if the content has 301 redirections.. Please can you help me optimize it better because it's too slow ...
0
votes
0answers
8 views

Reducing allocations in arbitrary precision calculations with Julia

I am new to Julia and have only written in python before which is most likely also reflected by my coding style. Unfortunately, my applications require very high numerical precision which is why I am ...
4
votes
2answers
46 views

Read a csv file and insert into DB table

I've found some resources about PHP performance optimization here and there but I don't know how to start. I send 130k CSV rows in approximatively 7min. My script read CSV file and send ...
0
votes
0answers
32 views

Python pynput keyboard + mouse input printer

I needed to have input shown for some things in a game I play on Linux, but Linux doesn't seem to have any good input display programs. I decided it would be good enough to have python print to a pair ...
1
vote
1answer
71 views

C++ Fast Fourier transform attempt 2

This is a follow up for C++ Fast Fourier transform . I did end up changing the algorithm slightly to reduce the memory usage. ...
0
votes
1answer
29 views

Speed up a function that checks for a sequence

I created a function yes.seq that takes two arguments, a pattern pat and data dat, the ...
1
vote
0answers
29 views
1
vote
1answer
36 views

Performance issue in python- network creation based on the Euclidean distance with nested for loops is too slow

I want to create a network in which the links are formed based on a similarity metric defined as the Euclidean distance between the nodes. The distance is calculated using socio-demographic features ...
4
votes
2answers
77 views

Converting Integers to roman between 1 and 1000

Below is my code for the problem: ...
1
vote
1answer
60 views

decreasing solver speed

How can I decrease the time complexity and increase efficiency, without writing a new algorithm. My solution solves the majority of puzzles in a fast time, but for some difficult ones it can take over ...
3
votes
1answer
86 views
+150

Skyscraper Solver for NxN Size

I try to solve a kata on codewars which let you write a skyscraper solver for skyscrapers up to size 11x11. Basic Example what is a skyscraper puzzle (here with 4by4 but the principle stays the same): ...
0
votes
0answers
21 views

Copy a block of data into existing cells, adding a new line

Wondering about efficiency here - I have a bit of code that does what I want; but it is terribly slow. I structured the code in a way that made sense to me logically, but I'm wondering if someone else ...
14
votes
3answers
4k views

C++ Fast Fourier transform

This is a very simple FFT, I am wondering what I can do to make this faster and more memory efficient from the programming side (better data types, and maybe some tricks like unrolling loops or using ...
1
vote
1answer
46 views

Byte array comparison - efficiency

I have a TCP Listener with NetworkStream that reads 530 bytes from the Client once a second. Within the TCP Listener ...
0
votes
0answers
26 views

LC medium, matrix set zeros, accepted answer but not top

I've solved LC medium problem, set zeros. Below code is accepted and all test cases were passing. But my code came in the last 10% of accepted answers wrt performance. Can someone help me identify ...
6
votes
3answers
1k views

Vigenère Cipher problem in competitive programming

I've just started doing programming problems. https://icpcarchive.ecs.baylor.edu/external/58/p5880.pdf The code below works fine, but my run time is 2.715 seconds and the time limit is 3 seconds. How ...
5
votes
1answer
71 views

Rust Book: The Twelve Days of Christmas

In order to learn Rust I'm going through The Rust Book and did the implemented a program for the following exercise: Print the lyrics to the Christmas carol “The Twelve Days of Christmas,” taking ...
5
votes
3answers
233 views

Class showing a format similar to var_dump RC5 Version

Some methods of this library require some improvements (see this description): In the constructor I am trying to create the possibility that the user modifies the ...
2
votes
1answer
64 views

Is repository pattern violated while using IQueryable outside of it?

I am writting an API backend application using .NET Core and Visual Studio. Here is the solution structure: [ProjectName] - Solution ...
0
votes
1answer
53 views

getint-like function

You probably know the following problem: You have written a small program that runs in your console and want the user to enter something. of course, it is very inconvenient when the user types the ...
4
votes
2answers
95 views

Dynamic Array in java

I am implementing a class to mimic dynamic array as a part of my learning process of data structures. I have written the following class which works as a dynamic array data structure. I have gone ...
2
votes
1answer
60 views

Optimizing Dijkstra on grid Python (Microsoft Interview)

Given a square grid of size N, each cell of which contains integer cost which represents a cost to traverse through that cell, we need to find a path from top left cell to bottom right cell by which ...
0
votes
0answers
22 views

Faster way to open xarray file from zip folder stored on S3

So I want to open xarray file which is stored inside zip folder located on S3 bucket. And here's my attempt. ...
0
votes
0answers
64 views

Is there a way to optimize this graphics/bitmap drawing code in C#?

I am not doing anything fancy so not sure if there are any tricks to make it faster. It's a progress bar where I draw some numeric text on top. I only draw 1 pixel height image and then resize it. But ...
2
votes
2answers
53 views

CSES - Number Spiral - Java TLE

My java code for CSES Introductory problem Number Spiral gives TLE for large inputs, like Input : 100000 170550340 943050741 121998376 943430501 689913499 770079066 586095107 933655238 … (First line/...
-1
votes
1answer
57 views

Grid Dynamic Programming

atcoder.jp Problem Statement: There is a grid with H horizontal rows and W vertical columns. Let (i,j) denote the square at the ...
3
votes
1answer
78 views

Optimizing a diagonal matrix-vector multiplication (?diamv) kernel

For an (completely optional) assignment for an introductory course to programming with C++, I am trying to implement a diagonal matrix-vector multiplication (?diamv)...
3
votes
3answers
570 views

Bifurcating recursive calculation with redundant calculations

def T(n): if n <= 0: return 1 else: return T(n-1) + (n-1) * T(n-2) print T(4) I need an effective way to print out the output of the function <...
2
votes
3answers
71 views

Sort an array of integers with a hashset

I was trying to make a sorting algorithm for an array of integers. Here's are the steps/theory: It turns an array into a HashSet, iterates over every integer value ...
0
votes
1answer
67 views

loop inside loop over one array

I have the following code: ...
2
votes
1answer
26 views

Fast hamming distance function in Julia that returns a distance matrix

I would like to use Julia to compute the hamming distance on a very large dataset. I need to get back a distance matrix between rows in order to run further ...
0
votes
2answers
54 views

duplicate element removal

I have tried to remove the duplicate elements from the array using c language, here I am using 3 for loops to remove the duplicate elements. How can this optimize ...
-1
votes
1answer
102 views

Generating permutations fast

I run into a performance bottleneck in a program. I have to generate all permutations for a given sequence with size up to n=11. My code: ...
1
vote
0answers
24 views

Search rows in dataframe corresponding to a value in R - Performance & Scalability

Overview of the Question I would like to ask for performance/scalability feedback on an R function that I recently wrote. I have a large 4-column dataframe (the <...
3
votes
1answer
73 views

Strlen function optimization

So I'm making a strlen function and I thought I would use SIMD instructions for it. It runs fine but when comparing it to std::strlen(), it falls a lot behind. Any ideas on how to make it faster would ...
4
votes
2answers
124 views
0
votes
0answers
22 views

Compute integral of spline by chunk more efficiently

I have a program that alternates between 2 phases: REST and REG. During each phase, 2 positive quantities are computed ...
1
vote
0answers
22 views

Parsing a large XML file and storing in Postgres efficiently using Pythonic code

I have a bunch of large XML files that I have to parse and store in Postgres. I have done a lot of procedural code but I want to think in terms of objects and reap the benefits. Any help in that ...
2
votes
1answer
113 views

Counting binary substrings

The exercise i am working on requires me to read a binary sequence stored in a text file. The objective is to find the occurrences of all subsequences of length between a and b (their values are given ...
1
vote
1answer
44 views

Lookup an array against another with performance

I got an initial array, I am checking against another array to find how many objects have at least one instance of the Domain in data. I wonder if there is a more ...
4
votes
1answer
111 views

Efficient vector-like polymorphic container which retains type information

This is my attempt of implementing an efficient, cache-friendly, vector for polymorphic objects. From now on I will refer to "virtual functions" as functions which are dependent on an object'...
1
vote
1answer
70 views

return the number of times is state of bulb changed?

Today in an exam I faced a problem which is Toggled Switches(Hacker Earth) as it is an exam question So, I am unable to send the question or its link (exactly). Problem: we have to print a number ...
4
votes
2answers
345 views

Single Producer Single Consumer lockless ring buffer implementation

I am writing a simple ring buffer for my own education. Below is a crack at a strategy described in http://www.cse.cuhk.edu.hk/~pclee/www/pubs/ancs09poster.pdf : Producer and Consumer keep local ...
1
vote
1answer
65 views

I have code that loops through a column of a dataframe. How can I make this code faster? (Python/Pandas)

I have datasetA with 90,000 rows and datasetB with 5,000 rows. Each dataset has a column called "ID" with employee IDs. My goal is to to create another column in datasetA that identifies ...
4
votes
2answers
96 views

Language skill tester using Pygame

I made this little game that tests our language skills. It uses one external module, pinyin, which can be installed via the command prompt command ...
1
vote
1answer
35 views

Improving Efficiency of Random Walker

I'm seeing a web course of computational statistics, the first project consists of a random walker, the implementation I have done works as intended: ...

1
2 3 4 5
159