Skip to main content
Share Your Experience: Take the 2024 Developer 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
0 votes
0 answers
11 views

conv2 Template Function Implementation for Image in C++

This is a follow-up question for An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++. I am trying to implement conv2 template ...
JimmyHu's user avatar
  • 4,958
6 votes
1 answer
198 views

Reading a file into lines with mmap vs getline

I required a function to read a file into lines for a text editor, and ended up with two routines. One uses getline(), and the other uses ...
Harith's user avatar
  • 6,822
2 votes
1 answer
177 views

Leetcode: Number of Islands - BFS (Queue vs Recursion)

I was playing around with leetcode's Number of Islands. As per the challenge's description: Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the ...
ccot's user avatar
  • 331
1 vote
5 answers
1k views

How do I speedup this simulation program

This is a program to solve a differential equation numerically using Euler method. As of now, it is very slow, and I need to run 10000 Monte Carlo simulations. The differential equation is called ...
Jonathan Wick's user avatar
-2 votes
0 answers
76 views

Count how many numbers in a range have exactly three divisors

The challenge Given array a of n numbers, I need to count how many positive numbers less than each aᵢ have exactly 3 divisors. Constraints 1 <= aᵢ <= 2.5 * 10¹³ In other words, the minimum ...
Muhammad Usman's user avatar
8 votes
3 answers
1k views

Bug Byte puzzle from Jane Street

This is a puzzle from Jane Street. Given this graph: Fill in the edge weights in the graph with the numbers 1 through 24, using each number exactly once. Labeled nodes provide some additional ...
Marc's user avatar
  • 5,604
5 votes
1 answer
542 views

The Wu line drawing algorithm for anti-aliased lines optimization

I need to optimize the following function with low-level optimizations (No SIMD, Multithreading). I already applied a lot of optimizations and got it ~65% faster, but it is possible to get it 200% ...
Adyfe's user avatar
  • 59
3 votes
2 answers
81 views

Optimizing a Function to Check Pronic Numbers in JavaScript

I've written a function in JavaScript to check whether a given number is a Pronic number. A Pronic number, also known as an oblong number, rectangular number, or ...
XMehdi01's user avatar
  • 523
3 votes
2 answers
51 views

Optimizing a Function to Generate a Row of Consecutive Odd Numbers in a Triangle

I've written a JavaScript function that generates a row of consecutive odd numbers in a triangle. The triangle looks like this: ...
XMehdi01's user avatar
  • 523
1 vote
2 answers
63 views

Using odd prime powers, my heuristic tries to solve instances of Exact 3 Cover in polytime, what can be done to optimize it?

By the way, a heuristic is not the same thing as a proven working algorithm that solves all input instances. It could either be experimental or be used to study intricacies in a problem. The purpose ...
The T's user avatar
  • 451
9 votes
4 answers
2k views

Implementing a simple byte manipulation encryption

Can you kindly take a look at the code? Any suggestions regarding performance, readability, potential bugs, portability, security measures, etc. are highly appreciated. The code reads a character, a ...
user174174's user avatar
1 vote
0 answers
49 views

Pytorch code running slow for Deep Q learning (Reinforcement Learning)

I'm a new student in reinforcement learning. Below is the code that I wrote for deep Q learning: ...
Jahid Chowdhury Choton's user avatar
2 votes
1 answer
73 views

Determining the least dangerous tags with over 1K answers to answer

So I thought I'd take another shot at making a SEDE query after being somewhat inactive after a while. Essentially what this does is that it takes the tags that have at least 1000 answers for that tag ...
CrSb0001's user avatar
  • 279
6 votes
1 answer
310 views

Codeforces: D2. Counting Is Fun (Hard Version)

The code works okay for the following problem. Problem An array 𝑏 of 𝑚 non-negative integers is said to be good if all the elements of 𝑏 can be made equal to 0 using the following operation some (...
user24714692's user avatar
0 votes
0 answers
23 views

Fastest way of finding if current user has access to a folder with Powershell

I have a Powershell script that selects a random file in a lab environment and then reads, writes, creates, and deletes files to simulate a live environment. This lab also includes folders that I don'...
Tanaka Saito's user avatar
3 votes
1 answer
79 views

Simple C++ event loop - static vs dynamic dispatch performance

I have two extremely simple toy implementations of an event loop, and would like to understand the performance differences between them. First impl - events with a virtual 'handle' method - dynamic ...
Jnuk's user avatar
  • 33
3 votes
1 answer
84 views

Coding puzzle - Passing year books

Question: There are n students, numbered from 1 to n, each with their own yearbook. They would like to pass their yearbooks around and get them signed by other students. You're given a list of n ...
Hariharasudhan Gunasekaran's user avatar
2 votes
2 answers
121 views

BlackJack in python

I began creating blackjack in python; however, I'm looking to simulate it, so I'm thinking I'm going to need to optimize it so that I don't just leave my computer running for three hours waiting for ...
Joseph Beegle's user avatar
3 votes
2 answers
222 views

Tic-tac-toe OOP Minimax Algorithm

I wrote a module that I intend to use in my next tic-tac-toe project. All it is is a class that stores the boardstate along with some methods/properties. The biggest thing is the minimax alg. As shown ...
flakpm's user avatar
  • 55
6 votes
4 answers
427 views

Optimal Solution for the Four Divisors Problem on LeetCode

I recently encountered the Four Divisors problem on LeetCode and managed to achieve a 100% beat rate with my solution. I'd like to share it with you all and gather feedback on its effectiveness and ...
BrunoBarreto's user avatar
1 vote
0 answers
129 views

Json4 parser in Typescript - Optimized

Context This review-request is a follow-up to this question. After the initial implementation, which focused on spec-compliance mainly, I have made some revisions to improve the performance of the ...
Patrick Hollweck's user avatar
3 votes
1 answer
87 views

Multithread execution times are slow on Ubuntu and fast on Windows

I'm working on a project accelerating the execution of a Genetic Algorithm both on multiple cores and on a GPU. The algorithm is specifically suited for the solution of the Traveling Salesman Problem ...
Pietro Pianigiani's user avatar
2 votes
0 answers
61 views

Optimizing even more a C++ matrix class with expression templates using variadic templates

I looked at Bowie Owens' cppcon 2019 talk (the slides can be found here) where he shows how to implement a tridiagonal matrix classes using expression templates but without resorting to the CRTP. (It ...
11house's user avatar
  • 21
5 votes
1 answer
117 views

Creating random music covers using Conways Game of Life algorithm

(A sample cover art follows.) I'm currently working on replacing all the covers of my music files to have a unified theme, and I've started this project in Java to refresh my knowledge after a gap of ...
Zipity's user avatar
  • 51
3 votes
1 answer
73 views

Scraping website with Python and Selenium to collect data from dynamic website

Summary: The code scrapes the website and collects the data to store it in CSV. It also downloads selected information that is available for download in PDF format. The details and the entire code are ...
sangharsh's user avatar
  • 279
7 votes
3 answers
2k views

Simple TCP port scanner

I’ve done port scanner program. It works well and accurate, but there is a problem. It’s SUPER slow. That’s how it looks: ...
Eudziro's user avatar
  • 81
5 votes
1 answer
323 views

Leetcode: Largest Number

I was trying out leetcode's Largest Number. As per the challenge's description: Given a list of non-negative integers nums, arrange them such that they form the largest number and return it. Since ...
ccot's user avatar
  • 331
0 votes
0 answers
43 views

Unity Gesture Recognition Code in C#

I'm new to C# programming and have been working on a Unity project that incorporates gesture recognition using the PDollarGestureRecognizer library and Unity XR Hands package. My application is ...
user17410204's user avatar
7 votes
1 answer
264 views

Multithreading message queue system

For an application I'm developing, I need an system which allows a thread to submit messages to another thread. For this purpose I designed a message queue system with the following features. Any ...
Sam Coutteau's user avatar
4 votes
2 answers
241 views

This is a simple stopwatch cli application with a few options

My goal of this when I started writing it was simply that it be able to record thousandths of a second in a very performant and accurate way. I'm not sure I have achieved the performance aspect of ...
lull's user avatar
  • 43
3 votes
1 answer
113 views

Sorting the divisors of a given number

I am trying to sort all the divisors of a given number in the most efficient way. Below is my code for sorting the divisors: ...
Arjun Kumar's user avatar
2 votes
1 answer
54 views

Looking for feedback on a flavour of Radix tree I wrote. This is version 2 of the class original posted on this forum

My project explores some ideas i've had regarding alternate data structures to the unorderd_map and map, and aiming the exploration to key sets with a non uniform distribution and key sets with common ...
ver2's user avatar
  • 61
4 votes
4 answers
1k views

Creating an O(n) algorithm for an array of integers

To avoid plagiarism in my university, I am going to modify the problem. Henry likes to jump from building to building. The heights of each building are given as a list of H numbers. We also number ...
Lesserrafim's user avatar
4 votes
2 answers
297 views

Simple version of NEAT

I have wrote my own simple version of NEAT and want to improve the code for mainly performance (training and runtime of a generation). This simple version of NEAT aims to perform somewhere near as ...
coder's user avatar
  • 121
1 vote
0 answers
45 views

React based Quiz Website

I have recently worked on a quiz application using the MERN stack. The application incorporates various features such as user authentication, quiz creation, scoring functionalities, and data ...
Ultimate's user avatar
  • 143
0 votes
0 answers
33 views

Add a new sheet for all files in folder, pull data from multiple reports for each one, save PDF/xlsx summary

I'd appreciate any help people can offer to make this process more efficient and less goofy. I've created a process to loop through a folder of approximately 100 files, add a new sheet with a base ...
Kris's user avatar
  • 1
4 votes
0 answers
68 views

Google App Script to take form responses submitted by teachers on their students and produce formatted PDF student reports

I'm not a programmer but, with help, I managed to make a Google Apps Script which takes reports, submitted by teachers on their students, to the Form Responses Sheet, and then selects all responses ...
StreetSavvypub's user avatar
2 votes
1 answer
49 views

Benchmarking putchar_many vs puts Performance for the Same Byte

Whilst writing an interpreter for Brainfuck, I had collapsed sequences of .......... to a single instruction OP_PUT (10) (Note ...
Harith's user avatar
  • 6,822
4 votes
1 answer
130 views

Longest spell to cast from pages of spellbook follow-up

This question is from the PCTC 2022 R2 Past Paper and is a follow-up on my previous question. Previous question I have implemented several solutions suggested, such as creating an array with pages ...
helielicopter123's user avatar
4 votes
0 answers
168 views

tbf - An Optimizing Brainfuck Interpreter and Transpiler in C

Language: The Brainfuck programming language consists of eight commands: ...
Harith's user avatar
  • 6,822
4 votes
1 answer
186 views

Looking for feedback on a flavour of Radix tree I wrote. The idea is speed on find() time if keys share common prefixes and are known ahead of time

My project explores some ideas i've had regarding alternate data structures to the unorderd_map and map, and aiming the exploration to key sets with a non uniform distribution and key sets with common ...
ver2's user avatar
  • 61
1 vote
2 answers
116 views

Miller-Rabin prime test

I have an implementation of the Miller-Rabin prime test, coded in Python 3. I want to use that as a comparison to a prime test which I coded myself. Unfortunately I have no idea how "fast" ...
Lereu's user avatar
  • 141
8 votes
2 answers
258 views

Filling a buffer with a repeating pattern of N bytes

My program will clear the screen to a 24bit RGB color; in other words, it will fill a buffer with a repeating pattern of 3 bytes. So I wrote patternMemcpy to perform this operation efficiently*. It ...
Vortex 2728182818's user avatar
9 votes
4 answers
1k views

Reverse Engineering Data Files (Binary Visualization)

Binary Visualization based on Christopher Domas talk: youtube link and this Russian programmer where I discovered this talk: youtube link. Algorithm: Scan the pairs of bytes of a file with a sliding ...
Harith's user avatar
  • 6,822
2 votes
1 answer
181 views

Autocorrelation of a vector series

Related: Autocorrelation of a vector series (2) The given C# source code computed autocorrelation of a vector series. The listing gives accurate results, but is horribly slow. How can I optimize it to ...
user366312's user avatar
4 votes
2 answers
477 views

Leetcode: Steps to Make Array Non-decreasing

I was trying out leetcode's Steps to Make Array Non-decreasing As per the challenge's description: You are given a 0-indexed integer array nums. In one step, remove all elements nums[i] where nums[i ...
ccot's user avatar
  • 331
4 votes
1 answer
95 views

What could be the more optimised way to get all unique subarray which equals to a target

I am trying to solve Combination Sum II on LeetCode. I was able to derive a recursive solution for the problem but it is not optimised as it only beats 10% of the solutions. Combination Sum II Given ...
Dr._Duck's user avatar
6 votes
1 answer
898 views

Show how close a user is to being unsung

So this morning, I decided to create a SEDE query that answers the age-old question "How close am I to being Unsung?" because I recently polished up my first SEDE query and I realized that I ...
CrSb0001's user avatar
  • 279
4 votes
3 answers
557 views

Leetcode 3sum problem solution

The problem is: Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] where ...
Oliver's user avatar
  • 41
1 vote
2 answers
121 views

Optimizing an algebraic assignment puzzle

I am going to do a math competition which allows writing programs to solve problems. The code attempts to solve problem 25 from the Purple Comet Spring 2004 Mathematics Meet: In the addition problem <...
Lucien Jaccon's user avatar

1
2 3 4 5
155