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

Distance checking of normalized vectors?

I've been learning C#/XNA in an attempt to make a game for the past few weeks so maybe this is an obvious newbie thing, but here goes: I've been making a fairly simple 2D game, so I have a list of ~...
1
vote
1answer
40 views

Python right position for a Error message in a class [closed]

first of all sorry for this easy question. I have a class ...
1
vote
1answer
92 views

python Improve a function in a elegant way

I have a grid as ...
1
vote
1answer
117 views

Which components of this r loop are inefficient?

I realize that there is a surfeit of posts on SE/SO about optimizing one's R for() loops. I'm afraid, though, that I don't understand all of the guidance in the answers there, or how to apply their ...
3
votes
1answer
383 views

Four color theorem

I'm trying to solve the four color theorem in Ruby. A map is like this: ccaaaa baaadc babcdc bbbcdc abcccc I have this, but it's slow. How can I make it better? ...
3
votes
1answer
123 views

Optimize jQuery Iteration

I have a list of elements (well, nested lists of elements, really) that the user can reorder (using jQuery sortable()). A simplified view of the structure is ...
1
vote
1answer
690 views

How can I implement the generic repository pattern and improve the performance for the code below?

I've used EF-DB first approach and have written a simple app to retrieve the data from the database and show it in the view. The code is simple and ok for a beginner like me, but how can I implement ...
3
votes
3answers
188 views

Remove code duplication inside of a loop preserving performance

I'm coding a 2D collision engine, and I need to merge adjacent axis-aligned bounding boxes depending on a direction (left, right, top, bottom). The four cases are very similar, except for the if ...
1
vote
3answers
719 views

Increasing size of video thumbnail on mouseover

This is a user JavaScript for YouTube. The point is to make the thumbnail bigger on mouseover. I just want some help making it better because I don't want it to waste resources with all the extensions ...
4
votes
2answers
2k views

Move object by one up or down algorithm in a custom order

Basically, I did an object (using hibernate) with a field called sorting_order. This field needs to be unique and I wish to swap two object by one. So one element has to be after or before the current ...
-2
votes
1answer
91 views

Project RGB with Switches [closed]

I am working on project in which I need to display different colors on RGB led. I am using pwm to drive different colors on LED. My Pic is PIC24FJ64GA004 with which I am working on now. Basic concept ...
2
votes
1answer
67 views

Creating and referencing markup…cloning, etc. efficient system for this plugin

I am pulling multiple feeds from youtube that have a callback function which makes markup from each feed. They add that markup to a documentFragment stored in var data. When all the feeds have ...
3
votes
1answer
627 views

Storing folders of list of records in Google Drive

I've written a script using the Django ORM to store 'configuration settings' and interacting with the Google Drive API and another API. The script creates a base project folder and subfolders in ...
4
votes
1answer
146 views

Format current date

I was refactoring some code and found this: ...
6
votes
4answers
7k views

Using Javascript FileWriter with minimal use of closures

I'm currently writing a WebGL HTML5 game, and large part of the game initialization involved loading assets streamed over a websocket, and saving them to disk using the FileSystem API. As part of ...
4
votes
2answers
531 views

ObservablePriorityQueue<T> Implementation

I have a requirement in my current project that will need a Prioritised Queue that supports the IObservable interface. Please notify me of any problems with the implementation that I currently have: ...
0
votes
1answer
62 views

Optimizing a jquery user interface application

I'm working on a javascript intensive user-interface application. (At least it's intensive for me, it's my first serious javascript project). I have a few jquery functions going whenever a div is ...
1
vote
2answers
2k views

Optimizing code: longest repeating substring

I know i have some real problems with the following code (as others said). can you please help me to optimize it a little bit? Maybe some example of how to do it. (find the longest repeating ...
5
votes
1answer
2k views

Orthogonal range search for a static kd tree

I'm trying to optimise my implementation of a static kd tree to perform orthogonal range searches in C++. My problem: The code performs slowly even for a small number of queries when the number of ...
2
votes
3answers
1k views

Using Levenshtein distance to compare strings

My overall challenge and why this code was written was to compare two strings. One string being a description of a item in inventory and one string being a description of a item, but possibly ...
1
vote
1answer
63 views

Optimizing mathematical index calculation function

I have made a function which calculates the index of a point to which an arbitrary point on a polygon made of XY points belong. This is a visual representation: And this is the function I made: <...
4
votes
3answers
7k views

Calculating scores for predictions of football scores

I am writing a program which calculates the scores for participants of a small "Football Score Prediction" game. Rules are: if the match result(win/loss/draw) is predicted correctly: 1 point if the ...
4
votes
1answer
1k views

Looping through Radgrid in JS is slow, can this be faster?

I do a single select in one radgrid, and based upon that selection I want to select multiple rows in a different radgrid: ...
10
votes
1answer
901 views

C++ vs D - Algorithm Optimization/Conversion (Using vectors/arrays)

OK, I've been playing with D for a while (and been in love with its expressive power and simplicity, to be honest). However, since I'm still new to D, I'm facing a few issues. Let's take the ...
4
votes
1answer
545 views

Highlighting a nav list item based on the user's scroll position in that same page

You can see the JavaScript at the end of this post in action here. I've recently picked up JavaScript/jQuery and would love some feedback on how I'm implementing this functionality. As you can see, ...
9
votes
4answers
10k views

Consolidate list of ranges that overlap

I wanted to implemented an algorithm in Python 2.4 (so the odd construction for the conditional assignment) where given a list of ranges, the function returns another list with all ranges that overlap ...
3
votes
1answer
221 views

Setting a page number from the URL, with fallbacks

I have the following code, but it somehow looks a bit redundant. As I am new to ColdFusion, I am not sure how to optimize it. Can someone suggest an alternative? ...
2
votes
1answer
181 views

Optimize Clock Update Code To Prevent Bottleneck Resulting In Time Lost

I use the following PHP Code to output the user's local time and the servers time (office time). $local_time and $remote_time ...
4
votes
3answers
211 views

Optimize boolean statements

I have the following logic: bool a; bool b; int v = 0; //code here to set the values of a and b... if(b) { v = a ? 1 : 2; } else { v = a ? 0 : 1; } I ...
14
votes
1answer
3k views

Increasing speed of BWT inverse

I think understanding basic data compression and pattern finding / entropy reduction primitives is really important. Mostly the basic algorithms (before the many tweaks and optimizations are made) are ...
5
votes
1answer
15k views

How to make an iteration in a for-loop faster?

I have a list with contentlets and want all languages from every contentlet (I get these with the method ...
4
votes
2answers
935 views

“Find the Min” challenge on Facebook Hacker Cup

I was solving the "Find the Min" problem on Facebook Hacker Cup. The code below works fine for the sample inputs given there, but for input size as big as 109, this takes hours to return the solution....
2
votes
2answers
2k views

Basic PHP comment form

I am a programming novice. I've written this simple PHP script to run a very basic comment form and would appreciate any feedback, especially on these three topics: Efficiency (not sure the right ...
2
votes
1answer
1k views

Given a sorted array in increasing order, create a BST of minimum height

I know there are a few recursive ways to solve this problem but the code below is what came to mind for me. ...
4
votes
2answers
352 views

Sudoku Valid Arangements Permutations Enumerator

I wondered if anyone has any ideas to make this cleaner or more efficient. Mostly this was an exercise to generate the data once (So speed really isn't too important, but I'd love to see what ...
1
vote
3answers
5k views

Evaluating result for mastermind comparison

I'm implementing a Java version of the game Mastermind. My version uses numbers to represent colors, for example 2315. This function compares a string of numbers ...
1
vote
1answer
325 views

PHP File Serving code

I've been writing a small site which is essentially just a service API for other applications but deals with the caching and serving of files. In an effort to make the site as scalable and ...
3
votes
1answer
304 views

Optimization of code for searching in db

This is my code: ...
1
vote
4answers
2k views

Optimizing nested if statements in switch

I have this code and I think it is very slow, about 50ms. I need to make it execute faster: ...
3
votes
2answers
227 views

Can I improve this code for readability and/or performance?

I have some data that logs kWh. I want to be able to collect the data and produce a bar chart (I'm using the Microsoft ASP.Net Chart control). I have written code that works, but it looks a little ...
4
votes
4answers
696 views

Calendar code review

I wrote the following in Javascript and jQuery, and I'm wondering if there are any ways to improve the code, organize it better, and increase speed: ...
2
votes
1answer
288 views

ARM disassembler from ELF file in C

I'm writing a simple disassembler in C for learning. It is supposed to take a ELF file read in the contents of the ELF header then the individual program headers (potentially multiple) and print out ...
2
votes
1answer
1k views

Count the number of cyclic words in an input

Cyclic Words Problem Statement We can think of a cyclic word as a word written in a circle. To represent a cyclic word, we choose an arbitrary starting position and read the characters in ...
2
votes
1answer
2k views

Sorting parallel ArrayList

I have a model class that contains 3 ArrayList which are in order by parallel of the same size. ...
1
vote
1answer
1k views

Getting a valid datetime format from a string

I have this code in a class that gets a string, parses it, and makes some adjustments to get a valid datetime format from the string. An input string for this ...
3
votes
3answers
3k views

Searching item in array

I have a program that calculates some values and saves them to an array. Before save a value, program checks if there is already an identical value in array: ...

1
136 137
138
139 140
150