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
1answer
44 views

Recursively unpacking a javascript object

I'm seeing a React course, we were studying fundamentals of javascript for a while. We saw how to access the content of an object and display it in console. My solution for the problem of displaying ...
2
votes
0answers
36 views

JS icons animation

I've written a simple JS that takes care to animate an icon. At first I wrote it quickly and without paying attention to any kind of optimization: ...
5
votes
5answers
605 views

Implementation of Sieve of Eratosthenes in Java

I have implemented Sieve of Eratosthenes in Java as follows. Is there a way I can modify the below code to make it more efficient? The current execution time is 0.8481224 seconds ...
2
votes
2answers
111 views

Forms to enter trading information

My project has grown for a year and now comprises of 19 standard modules, 7 class modules 11 forms. Some of the forms appear to freeze when called but, in fact, they are just slow to respond, taking a ...
4
votes
3answers
153 views

Sudoku Solver and Generator in Python

I made a Sudoku Solver after following some tutorials. Then I made a Sudoku generator and everything works. I also used classes to make it look more organized. I wanted to know what I can do better to ...
1
vote
0answers
46 views

Bad performance of a Graph Algorithm

I implemented a solution for the problem below, but its performance is not good. I know I can find the solution online, I'm trying to understand what is causing the bad performance in ...
4
votes
3answers
139 views

Create a little adventure world

I have just recently picked up coding and am trying to improve my coding. I've written this bit of code to create a little adventure world. I haven't completed the code, everything runs how I want it ...
2
votes
4answers
90 views

Improving speed and simplify code of "leetcode" Roman Numbers converter

I just have the free account at leetcode. I've been practicing some coding there in preparation for interviews. But I can't see the solution logic behind the ...
2
votes
0answers
36 views

Measuring Performance of Class Instantiation with JMH

I'm new to writing benchmarks and would like some advice whether I am doing this correctly. I currently have two classes: Person.java and ...
1
vote
1answer
188 views

Changing the color of some pixels in an image in Swift

My code is working perfectly fine, except for one-thing. The performance is not up-to the mark. What I am trying to achieve is I have an image with a few circles (each circle has a border with ...
0
votes
0answers
104 views

NIQE score and PIQE score calculation for batch of images in Matlab

There are some image quality assessment methods for "no-reference" image quality analysis. Here, I am attempting to calculate the NIQE score and PIQE score for batch of images in Matlab. The ...
-1
votes
1answer
77 views
1
vote
3answers
99 views

Replace array values with product of all other values

Need help to optimize the following code for lower time complexity: ...
4
votes
3answers
106 views

Creating a binary word search 🔍

I recently crafted a binary word search puzzle using HTML, CSS and JavaScript to dynamically build grids within a grid: ...
2
votes
1answer
40 views

Draw triangles on the HTML canvas optimization

There is a function that draws triangles on the canvas area in each lines: ...
0
votes
2answers
31 views

Table-Value Function with row-level-locking

I'm implementing row-level-locking on a MS SQL Server. The function I created below works, but even with a very small data set, it takes a significant amount of time to return the results. If I were ...
5
votes
2answers
347 views

Randomized Queue with ArrayList from Princeton's Algorithm Book

In the book they recommend to utilize an Array, but I think that it's easier to use an ArrayList instead, is there any problem with that? Is this code well designed? ...
0
votes
2answers
46 views

Build list of prefixes, including the whole string

There is a string "abcdebfkj", we need to transform this string to the below array: expected o/p:   ...
3
votes
1answer
83 views

Finding similar values within a list of lists in Python

I am working on a machine learning problem with object detection. For now, I am trying to find GPS coordinates that are close to other GPS coordinates. If they are close, I want to make note of it by ...
1
vote
0answers
38 views

Codewars: Path Finder

Task You are at position [0, 0] in maze NxN and you can only move in one of the four cardinal directions (i.e. North, East, South, West). Return true if you can reach position [N-1, N-1] or false ...
-1
votes
1answer
79 views

Calculate certain ratios of "work", "low work", and "no work" over large date ranges

I have the following algorithm to calculate certain ratios of "work", "low work" and "no work" over a set date range (startDate, ...
1
vote
1answer
64 views

PHP Group associative Array duplicates and make subarrays of different values

I have this type of table: ...
0
votes
2answers
71 views

LeetCode 05 with Manacher's algorithm

I finished LeetCode 05 with simplified (for ease of implementation) Manacher's algorithm. IMHO it should keeps \$\mathcal{O}(n)\$ time and space complexity. However, LeetCode's benchmark ranked my ...
1
vote
1answer
45 views

Sending requests via Google Indexing API (Python)

I've started learning Python several months ago. This code uses Google API to send URLs to Googlebot. I appreciate it if someone can review my code, and advice better practices in classes/method ...
1
vote
1answer
79 views

Expanding on a problem from Automate the Boring Stuff

Note: this is not the solution for the "Character Picture Grid" problem from Automate the Boring Stuff. Instead, this is an expansion of that problem simply for the sake of understanding ...
1
vote
1answer
33 views

Extract sections of a file into separate files

I have a file of the form - >SDF123.1 blah blah ATCTCTGGAAACTCGGTGAAAGAGAGTAT AGTGATGAGGATGAGTGAG... >SBF123.1 blah blah ATCTCTGGAAACTCGGTGAAAGAGAGTAT AGTGATGAGGATGAGTGAG.... And I want to ...
1
vote
2answers
84 views

Optimal Price of Products after Discounts

Input consists of 2 lists Products: [[20, 'discount1', 'discount2']], [15, 'discount2'], [10, 'NONE', 'discount1']] Discounts: [['discount1', 1, 30], ['discount2', 2, 5.5]] = = = Each product list ...
3
votes
1answer
107 views

Better way of comparing two lists of dictionaries and display unique changes

Can I get a review of my code which compares 2 dictionaries and display unique changes. ...
-2
votes
1answer
41 views

Grab user info from database via exec

I'm using the following code to grab user info from my MySQL database via PHP by using exec to invoke a Python script. ...
1
vote
1answer
93 views

Performance optimisations using Span<T>

For parsing astronomical datasets (mostly images) I have written a parser that reads .fits files in C# .net5.0. The content part of the file basically constists of a blob (byte array) that holds all ...
1
vote
3answers
95 views

Encode event results as colors

I want to reduce time complexity of my code that solves the following problem. The program receives a positive distance d followed by a sequence of n events: An event can be either that a person ...
1
vote
0answers
36 views

Graph stored as adjacency list or as endpoints and intervals

I tried speeding up my Graph class, so I removed the Node class and Edge class, and decided to use arrays and ArrayLists. My 2 implementations seem very similar, ...
6
votes
3answers
2k views

Reading 100,000 data files in Python

I need to manipulate data found in multiple data files (~100,000 files). One single data file has ~60,000 rows and looks something like this: ...
1
vote
1answer
124 views

Simple encryption function for Excel sheets

I'm using this function to read a certain set of data in a hidden Sheet1 to do encryption based on the selection by the user. It's all working fine, but its kinda ...
2
votes
2answers
67 views

Complex Filter in one Opration

I am working on a Data-based application. I wrote a code to filter the table. The table has String and Numbers. I some filter ...
1
vote
1answer
54 views

Update image pixels based on different criteria

Problem statement: Assume a high resolution (> 3000 x 3000) image is given as input. The image pixels can be classified into one of the three categories namely text, background and drawing. There ...
1
vote
1answer
37 views

Setting Wallpaper with Xlib and ImageMagick cli

This program reads raw pixels from the pipe/stdin in a loop and set the root window background. ...
3
votes
1answer
53 views

Matlab vs C: Tensorproduct or Vec-trick (multiple times)

I am searching for a more efficient way to calculate the so called vec-trick used in Tensor algebra, see Wikipedia. Introduction: Suppose you have a matrix vector multiplication, where a matrix C ...
5
votes
3answers
431 views

Refactor JavaScript nested if-else

I'm really new to code optimization and JS. I would like to ask for help on optimizing my code. Thank you in advance. Here is my code: ...
2
votes
1answer
62 views

Multithread or multiprocess [closed]

This is my code: ...
3
votes
0answers
64 views

converting from byte arrays to strings of integers, and back

I have this code to go from an array of bytes (arbitrarily long) to a "bigint" string (really, an arbitrarily long string composed of integers 0-9), and go from that long integer string into ...
0
votes
4answers
214 views

Find the next prime at/after a given integer

I created a function that returns the next prime number greater or equal to the number given as an argument. My code works well, but I find it is very slow. The test suite take almost 60s and I want ...
3
votes
2answers
108 views

Comparing Three Columns and Copy Pasting data

I am using below code which is comparing three columns values and copy pasting the 4th column data into other column. My code is working fine but it is slow to perform the processing and takes much ...
19
votes
8answers
6k views

The car plate problem: generate from AAA0001 to ZZZ9999 skipping the 0000

I was given the problem (called "car plate problem") to write all the values that go from AAA0001 to ZZZ9999 with the following premises: Create all the possibilities from AAA0001 to ...
2
votes
0answers
34 views

AI learning to drive (simplistic) needing optimisation

So I have done a little program where the goal is trying to teach some cars (red and blue rectangles) to "drive" through genetic algorithm. It works well and I haven't seen any bugs, but the ...
2
votes
1answer
56 views

Faster, indexed, heuristic doubly-linked list data structure in Java: benchmark

I have this benchmark program for my indexed linked list. It looks like this: com.github.coderodde.util.benchmark.LinkedListBenchmarkRunner ...
2
votes
1answer
93 views

Faster, indexed, heuristic doubly-linked list data structure in Java: implementation

I have this doubly-linked list data structure that runs all the single-element operations in \$\Theta(\sqrt{n})\$ time (refer to this post and this repository). (See this for benchmarks.) (See this ...
0
votes
0answers
11 views

Pytorch Video Frames Dataset Implementation

I have a dataset of video frames in a folder with the directory structure looking like this: -parent -video_id -frame0 -frame1 -... My code, gathering ...
3
votes
1answer
76 views

Efficient (a XOR (b+1)) known (a XOR b) in C for the ChaCha algorithm

I'm currently trying to improve my ChaCha algorithm implementation. Here's the my code (written in C): ...