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
3
votes
0answers
33 views

esp8266 code for correctness of reset and overall performance [closed]

Please review my code for the performance and correctness, everything works and we get visible wifi access points by opening http://esp8266_ip_addres/hotspots ...
4
votes
2answers
72 views

Time axis with working days, weeks numbers, month-year

I made the bellow macro to create a time line in excel. It shows the working days, the week numbers and the month together with the year. First I start with projectstart date and projectend date. As ...
3
votes
2answers
107 views

Maxcounters in JavaScript

I am trying to solve this question: MaxCounters. Solving it is straightforward, but solving it fast enough is proving very difficult. How can I improve the performance of this code? At the moment it ...
2
votes
0answers
31 views

Givens QR decomposition in R or C++: poor performance (or lack thereof) for rectangular matrices

My own Givens-based QR decomposition function in R (pseudocode from Politecnico of Turin's math department) is the following: ...
2
votes
1answer
29 views

Putting the results of a first JSON file of to subparts of a second one when key matches

I have a geojson file with results for each province and one that gives other results for each constituency (an administrative part of the province). I would like to make a third one that puts the ...
2
votes
2answers
67 views

User-defined function for estimating coefficient of performance

I am using hourly weather data to estimate performance of commercial refrigeration systems under various parameters. The formula for estimating co-efficient of performance (COP) of these systems is ...
1
vote
1answer
63 views

C++ Code structure & Optimization: LR1Item

I've been working on an LR(1) parser, and I've just finished making the LR(1) item. I'm very rusty with C++, so any pointers (especially optimization and code structure) would be appreciated. Here are ...
1
vote
1answer
96 views

Exporting Stock Transaction Data to Excel

I am looking for improvements in the code below which is taking a long time to finish. Initially when I export around 26k+ records, it will take around 20-30 mins to finish. Usually then either the ...
4
votes
3answers
120 views

How can I optimize my code that uses nested for loops?

I am working to solve a problem where I need to determine if a Point lies on a line connecting two other Points. For example, ...
3
votes
1answer
51 views

Filter out unwanted substrings while generating all possible relevant substrings

Write a Program that determines where to add periods to a decimal string so that the resulting string is a valid IP address. There may be more than one valid IP address corresponding to a string, ...
-2
votes
1answer
48 views

emplace_back is faster than allocate once + move in c++11? [closed]

I have two fuctions: f2 - first allocate memory , then move data. f - deallocate + move = emplace_back. I am trying to understand what is faster and better to use in terms of performance and code ...
1
vote
1answer
71 views

Import huge XML data set into MongoDB while parsing data

I am currently working with the Stack Exchange Data Dump - to be more precise - with the dumped Posts.xml data set from Stack Overflow. What am I trying to achieve?...
3
votes
2answers
98 views

Efficiently generate large file to create SQL table and insert sample user data

Here's a function I use to generate a 2.5 gig SQL dump file for testing. It works but it takes a long time. How can I make it more efficient? ...
4
votes
4answers
204 views

LeetCode: Roman to Integer in Java

I tried solve this easy leetcode challenge in java. Challenge link Here is my solution ...
3
votes
0answers
102 views

C# code for minimizing the sum of an array by dividing it's elements (repetition allowed) by 2 for k times

The assumption is that k is quite large as compared to no. of elements in the array and division by 2 returns ceiling of the result. Request for your review and suggestions for further improvements ...
8
votes
1answer
186 views

Clone of mobile game Ballz

I have made a clone of the mobile game Ballz, and it works quite well. However, there are a few problems: Performance. When I have more than 50 balls in the game, the FPS dips from 60. I am unsure ...
6
votes
2answers
645 views

Counting Balanced numbers in a given array

I am trying a code challenge. Here is the problem description When an element is deleted from an array, the higher-indexed elements shift down one index to fill the gap. A "balancing element" ...
1
vote
0answers
40 views

One of my first Bash scripts - checking for best practice and error handling

I have a Bash script that resides on Remote Server A and transfers files from Remote Server 1 to Remote Server 2. Remote Server 2 is a Dropbox folder so in this script, I call another script (that's ...
4
votes
2answers
92 views

Ising model simulation using metropolis algorithm

I am new to this community; I have tried my best to respect the policy of the community. I have written the Monte Carlo metropolis algorithm for the ising model. I want to optimize the code. I have ...
2
votes
1answer
44 views

Reproduce Linux move command in C

I have the following code, made in C language, which reproduces the functionality of the mv (move) command from linux. The problem is that the code is very inefficient. How I can optimize or make the ...
1
vote
1answer
46 views

Speeding up a recursive Cantor pairing function

The Cantor Pairing function is a mathematical function which takes two integers and combines them into a single integer that is unique to that pair. This single integer can later be "unpaired" back ...
1
vote
0answers
39 views

How can I make my LZ77 algorithm to compress faster or to compress more?

So, I am trying to create a PNG compression library, and to do that I need to use the DEFLATE algorithm; DEFLATE consists of two parts, the LZ77 compression, and the Huffman Compression. Currently, my ...
1
vote
1answer
42 views

Large-scale pairwise similarity calculations of vectors

I am a C++ beginner and am working on a bit of code which calculates the pairwise cosine similarities between vectors. The vectors are TF-IDF vectors and the similarities are used to determine ...
1
vote
0answers
23 views

Vectorization of Mersenne Twister? [closed]

Ahoy friends. Right now i'm selling a huge amount of HDDs and usually i used DBAN or nwipe to perform this actions. Unfortunately the PRNG Mersenne Twister is quite slow, so i get a throughput of ...
1
vote
0answers
19 views

Slow bash script for getting audio/video duration

I have created a bash script to generate a HTML file, which will have the duration of the audio/video files in the current folder. The script uses ffprobe to fetch ...
2
votes
0answers
25 views

A very fast Game of Life

The rules of John Conway's Game of Life are simple: An OFF pixel that has 3 live neighbours is turned ON. An ON pixel that has anything other than 2 or 3 live neighbours is turned OFF. Many people ...
2
votes
0answers
67 views

Google Foobar -Expanding Nebula - Code takes too long

So I'm on level 5 of Google Foobar, and the Question is Expanding Nebula. It goes as follows : Expanding Nebula You've escaped Commander Lambda's exploding space station along with numerous escape ...
1
vote
1answer
71 views

Binary Search implementation: HackerRank - Climbing the Leaderboard

My code passes 11 out of 12 test cases. I was wondering where I can improve my code. NOTE: This code needs performance improvement, as it is working for most of the cases. To mu knowledge it would ...
1
vote
0answers
21 views

Log Likelihood Calculations for Censored Data in R

I am calculating the log-likelihood of data that have some observations censored. For uncensored "a" clusters, the likelihood calculates P(Y=y). For censored "b" clusters, it calculates that Y is at ...
1
vote
1answer
29 views

Performance stored procedure update multi-coulmn sql

I have a stored procedure the every 5 min run in sqlserver high cost iO/cpu do you have any idea to tune this query ...
3
votes
2answers
60 views

SPOJ - ADDREV (Adding Reversed Numbers)

https://www.spoj.com/problems/ADDREV/ My answer to ADDREV challenge on SPOJ (link to the problem given above), written in JAVA, was accepted. However, the timing was 1.23 and memory used was 82M, ...
4
votes
2answers
252 views

More elegant way to count anagrams in Python?

Question I feel like my code could be more elegant/more pythonic/faster, but I can't think of too much more to improve. So, I've come to the internet to see what more can be done with standard python....
1
vote
1answer
79 views

connection to mongodb in golang

I am building an API server in golang with mongodb. My main.go file looks something like this: ...
1
vote
0answers
31 views

Profile maximum likelihood programming in R

I am calculating a likelihood surface for a modified negative binomial distribution with two parameters: mean R and dispersion k ...
4
votes
1answer
82 views

Why is append() slower than + and is there some oversight in the map() solution which slows it down?

I was trying out some variation in implementation of a leetcode example and was surprised by the runtimes. I was expecting it would be better to use map() than ...
0
votes
2answers
154 views

Sherlock and Anagrams in Javascript

I am trying to solve a Hackerrank problem Sherlock and Anagrams. I think my code is valid but somehow times out for some of the test cases. Any tips on how to improve its performance? Critique ...
2
votes
0answers
43 views

Sharing model for different ORM's

I am building a MySQL to Realmdb converter app. I use Entity Framework to deal with MySQL, so below is the code of one of my model classes. I don't want to have multiple classes representing the same ...
2
votes
3answers
103 views

Efficiently convert 60 GB JSON file to a csv file

Description Simply take a JSON file as input and convert the data in it into a CSV file. I won't describe the functionality in too much detail since I have reasonable docstrings for that. As you can ...
0
votes
2answers
67 views

Iterate dictionary object efficiently in c# with pre defined keys? [closed]

I have a dictionary that I need to iterate efficiently. I already know about the keys beforehand which I need to extract from values dictionary object. What's the ...
1
vote
2answers
97 views

How can I speed up this solution to the “Rock-Paper-Scissors Tournament”

As I have recently been selected to participate in my country's final preselection to the IOI -- this took me aback -- I have decided to get a bit more serious about competetitive programming. The ...
1
vote
2answers
85 views

Initial Mass Function for young star clusters and disk field stars

I hope you can help with improving my code. I am defining a function which draws out elements of a certain mass, one by one, from a distribution constrained by the function ...
6
votes
2answers
260 views

Hash table lookup is very slow - though only ever iterating through one entry

So I'm writing a hobby programming language interpreter in C. It works but has serious performance problems. According to gprof, the following function takes 30% ...
6
votes
1answer
52 views

Improving the performance of interpolating between two arrays

The Problem I am currently writing a script that converts images into numerical array representation and then calculates "in-between" images based on linear interpolation between the start and end ...
1
vote
1answer
67 views

Using a factory pattern many times [closed]

This is my first question on this website and I hope it goes well. I have created a Kotlin factory pattern and I am using it very frequently. the code I use it consists of functions inside a class. ...
1
vote
0answers
26 views

Cooperator/competitor agent-based simulation

My agent-based simulation spends about 60% of its runtime in one function, as the profiler shows. That function looks as follows. ...
4
votes
5answers
281 views

Find greatest number in array that is a product of some two elements in the same array

Given an array a, find the greatest number in a that is a product of two elements in a. If there are no two elements in a that can be multiplied to produce another element contained in a, return -1. ...
6
votes
2answers
214 views

Root finding using bisection method in Python

This code below is supposed to calculate the root of a function using bisection method. I am a newbie to Python, so I do not know how to raise errors. Also, I would like to have a general review on ...
3
votes
1answer
53 views

Implementation of Luhn Check Algorithm

I am beginner a 1st year cs student. I am taking CS50 and I completed the first week problem of implementing Luhn Check algorithm. Though my solution works I feel it's very sloppy and not efficient. ...
1
vote
1answer
46 views

Optimising multiple string splits and concatenations

I'm writing a program in Unity and am using a TextMeshProUGUI object (named history) to hold a list of messages to act as a ...
2
votes
1answer
87 views

Multiplying an array by a number in C and how can achive vectorize the principal loop in this function?

I have code in C that multiplies each element of an array by a number (0-9), resulting in a series of base 10 digits. I compile with ...