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
4 votes
1 answer
277 views

Getting JSON from a remote API sometimes hangs. Can I make this any faster?

Testing on localhost, it takes a bit longer to get the results than I would like and gives me this PHP error: Fatal error: Maximum execution time of 30 seconds exceeded I am wondering if there is ...
devs's user avatar
  • 41
7 votes
3 answers
12k views

Determining common divisors of two numbers

Is there a better algorithm for finding the common divisors of two numbers? Can this code be shortened? ...
Razor1692's user avatar
  • 377
6 votes
1 answer
225 views

Running a block of code on every interval except the first iteration

I am working with an encryption algorithm that looks like this The key is a number stored in 4 bytes. For each byte in the message, XOR it with the corresponding byte in the key When you reach the ...
MxLDevs's user avatar
  • 197
3 votes
1 answer
2k views

How to make this csv-reading PHP code more efficient?

I have the following code that reads a .csv file that than outputs the result in the form of a HTML table: ...
user33142's user avatar
  • 133
5 votes
5 answers
1k views

Permutation algorithm

I was asked to write a permutation algorithm to find the permutations of {a,b,c}. Since this is a famous question to which an answer is readily available online, I wanted to do it a little differently,...
madu's user avatar
  • 151
14 votes
4 answers
68k views

Tiny text adventure

I made a small text adventure. I'm not trying to make it appealing to anyone, but rather just to practice my Python skills. I am fairly new to Python and this was my next step after making a console ...
Elliott Rhys's user avatar
1 vote
2 answers
139 views

How to optimize Cookie Parsing?

I have written this code for cookie parsing. Can anyone tell me what optimizations we can do in this or what can we do to make it more concise? ...
Sachin Jain's user avatar
3 votes
2 answers
187 views

Find number matching range

I have code that checks the range of a value and sets a variable accordingly. ...
kursus's user avatar
  • 133
1 vote
1 answer
644 views

Is it feasible to create a syslog server which writes to a client dataset?

I'm creating a simple syslog server in Delphi XE2 using Indy's TIdSyslogServer. I've decided to make it dump into a ...
Jerry Dodge's user avatar
4 votes
1 answer
461 views

Adding buttons for a text adventure game

The game will be combination of text adventure (navigate through buttons), RPG, sandbox, strategy and turn-based game where the main task of player is to explore the game's world and survive (since I ...
Dravic's user avatar
  • 43
12 votes
5 answers
7k views

Efficient FizzBuzz

I wrote the following Fizz Buzz program. How can I improve it or make it more efficient? ...
Pooja's user avatar
  • 223
2 votes
3 answers
4k views

Determining whether or not a number is prime

I wrote this code in Java without using any methods, just by using simple for loop and if statements. When we input a number, ...
Razor1692's user avatar
  • 377
3 votes
3 answers
132 views

jQuery function that modifies a DIV

How can I shorten and optimize this code which displays then hides a DIV? ...
block14's user avatar
  • 237
4 votes
1 answer
341 views

Streambuffer and string manipulation

One of my colleagues told me that you can use streambuffer for std::string, and instead of using ...
david's user avatar
  • 1,647
3 votes
3 answers
183 views

I feel as if my quicksort can be made more efficient, but what?

I just learned the quicksort algorithm and tried to implement it, but it feels dirty: ...
Kenneth Worden's user avatar
5 votes
3 answers
199 views

log4j 1.2 - own check for verbose logs?

In my code's package, I have a flag such as: public static final boolean LOGS_VERBOSE = false; And in worker classes (multi threaded ...
tgkprog's user avatar
  • 223
2 votes
1 answer
106 views

parallel.For function

I am trying to add parallelism. The following function works. For testing purposes, calculating chunckLength is fine. However, when I allocate more cores, it seems ...
Stuart Gordon's user avatar
1 vote
2 answers
335 views

Translating month number into month name

Time is very important from times immemorial. Doing great things and making it happen in less time is more important as it can mean less effort. So I really like to know which way is faster and more ...
Mawia HL's user avatar
  • 285
4 votes
2 answers
4k views

Prolog Sudoku solver taking too long

I was wondering if there's any way I can improve this code's execution. I want to use it on a 9*9 grid, but it takes too long to solve this as 4*4. This program takes as input a 4*4 matrix ...
user1730250's user avatar
3 votes
1 answer
74 views

Optimizing an IP generation method

I have designed a proxy server which has the feature to manage miniature separate networks. Each network has space to have up to 500 nodes or 500 IPs. The code for getting a new virtual IP is based on ...
Umair Ahmed's user avatar
4 votes
2 answers
163 views

Why is this program for extracting IDs from a file so slow?

This is roughly what my data file looks like: ...
Matt's user avatar
  • 305
1 vote
4 answers
239 views

How can I make this code more readable and efficient?

How can I rewrite this code to make it more readable and, if possible, more efficient? The conditions are entirely necessary in this problem, but how could I rewrite those ...
Eagledelt's user avatar
6 votes
2 answers
931 views

How to improve this algorithm for building a graphs closures

We have a large directed acyclic graph and a requirement to filter it by allowing a user to select certain nodes and then we remove all nodes that are not selected nodes, ancestors of those nodes, or ...
Paul D'Ambra's user avatar
2 votes
2 answers
1k views

Thoughts on my byte array library

Here is a small library which manages writing into and reading out a byte array. It uses TValue arrays to get and put data, its my first time using them. Its crudely written, and poorly optimized but ...
Umair Ahmed's user avatar
4 votes
1 answer
2k views

Path Planning - Greedy Best First Search

I'm working on a path planning algorithm that will be converted to RobotC. I'm trying to optimize it so that it uses the least amount of memory, as the robot it will be implemented on has supposedly ...
teynon's user avatar
  • 143
5 votes
3 answers
7k views

Efficient human readable timedelta

I wanted to write a human readable datetime.timedelta that can be used in log files. Eg, "Report issued 1 hour, 44 minutes, 20 seconds ago" I noticed that casting a timedelta to str() generates ...
user avatar
4 votes
2 answers
797 views

"Edit distance" UVA programming challenge

I'm trying to solve a programming challenge for fun. The programming challenge is here and my solution for the same can be found here. It currently causes an exceeded time limit. ...
user avatar
2 votes
1 answer
699 views

How to optimize the following code in order to decrease the execution time?

I'm dealing with huge amount of data. I've written following code into a function to find out similar questions. It's working perfectly but it is taking too much time in execution. Can anyone help me ...
PHPLover's user avatar
  • 141
3 votes
2 answers
5k views

Singleton holding and notifying registered listeners

Suppose I am listening for network changes with the following listener: ...
Tadej's user avatar
  • 237
4 votes
1 answer
3k views

Find missing numbers in a range, with duplicate numbers in a sorted array

Suggestions for cleanup and optimization request. This question is a follow-up question on this post. Lets assume the range of 1, 2, 3, 4. This function takes in an array of repeated ...
JavaDeveloper's user avatar
0 votes
1 answer
927 views

Java reflection: Inject data generically and safely [closed]

I have become interested in reflection and I wrote a class to wrap an Object so that I can access its private instance fields. The code works great. I do not need to wory about the exceptions in the <...
Mr. Polywhirl's user avatar
3 votes
2 answers
281 views

Hanging men efficiently

I can't seem to get the formatting right, so here is the pastebin if needed: http://pastebin.com/g6VmdYbM ...
Modify You's user avatar
5 votes
2 answers
184 views

Performance/Optimization of Knapsack(ish) algorithm for move generation for a game

I'm writing an AI for an italian Card game scopa http://en.wikipedia.org/wiki/Scopa And as part of it i need to generate all moves available to the user. A move consists of finding cards in the ...
thermite's user avatar
  • 153
-3 votes
1 answer
175 views

How would I improve this class in terms of responsiveness and performance?

I'm about to release this application as a hobby and I'm wondering how would I improve the speed of the calculations and overall responsiveness of the class? I have covered a module briefly in data ...
Brian Var's user avatar
  • 109
5 votes
2 answers
231 views

CSS selector for image captions

I have this CSS selector: .img + *{ } Which, from my understanding, will make the browser look for all the elements and then select only those which follow an ...
Adonis K. Kakoulidis's user avatar
4 votes
3 answers
2k views

SimCity clone with PyGame

I am doing my best to keep this code clean and fast, but as I add more to the game, it seems to get harder to maintain a frame-rate higher than 200! I believe that the culprit is a somewhat large <...
Sam Tubb's user avatar
  • 539
1 vote
1 answer
1k views

Android code optimization - AsyncTask

I have finished my first Android App, but I am getting lots of skipped frame messages from Choreographer. So, I started reading and got the impression that I should put as less calculations/works as ...
abdfahim's user avatar
  • 171
12 votes
5 answers
10k views

Optimize random number generator

I have a method that generates a 10 digit random number where each digit occurs only once. eg: 0123456789 3645720918 Is there any way this method could be ...
Sionnach733's user avatar
2 votes
1 answer
949 views

Improve speed of LINQ query

How can I improve the speed of this LINQ query? ...
Arkinghor's user avatar
11 votes
2 answers
593 views

SimCity clone performance

I am working on a SimCity clone, and I am noticing a drop in frame rate as I add more objects to my map, now this is expected, but, when I fill the whole screen, the game maintains about 300 FPS. ...
Sam Tubb's user avatar
  • 539
2 votes
1 answer
3k views

Drawing a table in Python3 [closed]

I have created a module to draw text tables. The relevant parts are below and here's the full code for txtable). ...
3k-'s user avatar
  • 123
1 vote
3 answers
1k views

CSV file cleanup

I'm fairly new to Python and am going to be parsing hundreds of thousands of names eventually. What I wanted to do was take individual CSV files, and create new CSV files with only the info I wanted. ...
Adam's user avatar
  • 145
5 votes
1 answer
3k views

Given sum and product, find the two variables

Basically, find x and y given the product = xy and sum = x + y. I would like review on optimization, clean code, and complexity. It looks like O(1), but the while ...
JavaDeveloper's user avatar
4 votes
2 answers
2k views

Optimize Scipy Sparse Matrix Factorization code for SGD

I'm working on implementing the stochastic gradient descent algorithm for recommender systems (see Funk) using sparse matrices with Scipy. This is how a first basic implementation looks like: ...
Ana Todor's user avatar
  • 143
2 votes
1 answer
187 views

Query too slow - Optimization

I am having an issue with the following query returning results a bit too slow and I suspect I am missing something basic. My initial guess is the 'CASE' statement is taking too long to process its ...
Evan L's user avatar
  • 291
1 vote
1 answer
100 views

Increase efficiency of card-ordering program

As mentioned in @rolfl comment. What this program does is that it "resequences the cards using a fixed system and count the number of times the resequencing happens before the output is the same as ...
Liondancer's user avatar
  • 1,499
5 votes
1 answer
792 views

Regex parser - request for review and optimization

The whole question is Simplified regular expression engine. I have solved the question, and in turn felt the need to get it reviewed. Any suggestions for clean up and optimization would help. Also ...
JavaDeveloper's user avatar
5 votes
2 answers
2k views

How to optimize C# console application

i'm wondering is there any way to optimize this code? It must be able to work with big files, for example, formatting raw 140kb .txt file (12.5k words) takes 2 seconds (measured with Stopwatch class). ...
nuclearpeace's user avatar

1
151 152
153
154 155
175