Optimization is the act of improving a method or design. In programming, optimization usually takes the form of increasing the speed of an algorithm, or reducing the resources it requires.

learn more… | top users | synonyms (2)

5
votes
1answer
31 views

How can I make this program a bit more efficient?

So I'm trying to solve a SPOJ problem, which code is SAMER08A and this is the link: http://www.spoj.com/problems/SAMER08A/ The problem, is that when I ran my code in my IDE, the code works perfect ...
1
vote
1answer
26 views

Improving my jQuery animation

I wrote the following fo create an animation which collapses a navigation bar, load new content for it and expands it again. Meanwhile, the rest of the page content fades out, loads and fades in ...
0
votes
0answers
16 views

How to improve Collision Detection in Bricks in BreakOut Game

I've done my first BreakOut Game while completing an assignment for Stanford University CS Online Course for java. However I noticed during play testing that when the ball sometimes hits a brick ...
5
votes
3answers
156 views

Java string replace

I am new to Java and I am trying to learn about optimizing code to make it production ready. I have the following code below. I would like to know how I could optimize it. I thought by using a small ...
1
vote
0answers
15 views

Python: How do I optimize the solving of ODEs?

I have been trying to figure out a way to optimize the solving of ODEs in Python but haven't been able to achieve this goal. I tried getting help via a bounty on SO using cython but nothing came of ...
1
vote
0answers
12 views

Creating an expanding CCSprite cluster

I am creating an "explosion" of circle sprites from the character with this code, and I was wondering if there is a more effective way to do such things, because this just seems too stupid. (This is ...
1
vote
1answer
35 views

Drawing game objects using their Z-order property

I am creating a game, with Ruby scripting. Sprite and Label objects can be drawn on the screen. Depending on the order you draw them, one will overlap the other. To make things easier, I want to ...
1
vote
1answer
41 views

autocomplete jquery -renderItem- option

$(function() { function log( message ) { $( "<div>" ).text( message ).prependTo( "#log" ); $( "#grille" ).scrollTop( 0 ); } $( "#my_ac" ).autocomplete({ source: ...
1
vote
2answers
79 views

Email report generation from database

I have written a small batch job which will collect data from db and send mail to user. Can you please do a review of the code with design prinicples in mind and also with best practices for Db and ...
1
vote
2answers
72 views

Why this Erlang code works about one minute on my machine?

Why this Erlang code works about one minute on my machine? On Pascal something likes this tooks less then second on my machine. What I can do to speed up it? -module(slow). -export([slow/0]). ...
2
votes
1answer
122 views

Idiomatic Clojure? Performant & functional enough?

Problem Disclaimer: This is my first clojure function & I'm still busy finishing the last chapters of "Programming Clojure". Thanks! :) I am writing a function to randomly flood-fill parts of a ...
5
votes
1answer
106 views

Suggestions on how to improve this .htaccess file for page load speed

Here is my standard .htaccess file, any suggestions on how I can improve it with regards to page load speed? Would gZip instead of DEFLATE make any sort of difference? ExpiresActive On RewriteEngine ...
9
votes
1answer
202 views

Improve Parallel Cache with Reactive Extensions & Unity Interception

The requirement is to be able to cache method invocations made on a boundary layer (Services layer). I'm using Unity to inject the concrete implementation of the Service layer classes. The ...
1
vote
1answer
171 views

Rails feed parser to be improved

This is my feed parser method using feedzirra. It works but I feel dirty because I can't figure out how to better this code. Any suggestion? class Feed < ActiveRecord::Base attr_accessible ...
4
votes
1answer
103 views

Optimizing python code for big data sets

I'm trying to optimize a python string that works on big data sets, the way it works is by taking in a with a list of keywords and scores and taking in a file loaded with data from the twitter api. ...
0
votes
1answer
64 views

Why this code kills my system?

Why this code kills my system? -module(slow2). -export([slow2/0]). slow2() -> io:format("~p\n", [perms(lists:seq(0, 9))]). perms([]) -> [[]]; perms(L) -> [[H|T] || H <- L, T <- ...
1
vote
1answer
12 views

Mixin, @extend or (silent) class?

I am struggling with the basic concepts of SASS. I have a page that has multiple section, all of them are sharing properties like width, font-size etc. I would like to optimize my code and do one of ...
0
votes
1answer
34 views

Improving the redundant code I have while inserting to Cassandra

I have started working with Cassandra database recently. And I was trying to insert some data into one of my Column Family that I have created. Below is the code by which I am trying to insert into ...
1
vote
1answer
238 views

Data model code review for iOS app

I'm new to iOS development and I'm having trouble figuring out how to efficiently load my app's data at launch time. My app consists of a UITableView that is populated with a list of songs. Each cell ...
1
vote
3answers
150 views

could someone please review my code. it seems too convoluted. I am just starting to learn to go from blog to hosting

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> ...
1
vote
2answers
184 views

How to optimize this SQL delete

I want to optimize the performance of this SQL query. If I populate this hashtable with one million keys the query will take around minute. How I can optimize this Java method for faster execution? ...
3
votes
1answer
75 views

Project Euler 407: Is there any more optimal way to solve this idempotent equation (modulo n ring)?

Project Euler problem 407: If we calculate a2 mod 6 for 0 ≤ a ≤ 5 we get: 0, 1, 4, 3, 4, 1. The largest value of a such that a2 mod 6 = a is 4. Let's call M(n) the largest value of a < n ...
2
votes
1answer
61 views

TicTacToe in Java

I created this game in Java: import java.util.Scanner; public class TicTacToe { public static Scanner input = new Scanner(System.in); public static String getName(int noPlayer) { ...
0
votes
1answer
64 views

Learning R – repeated measures simulator optimisation

I am learning to program in R and to do that and create something useful in the process, I have decided to rewrite this Java applet for repeated measures simulation and to implement some new ...
-1
votes
1answer
148 views

my first comprehensive solution : C# “DataDriven Web Appication” Ft. my “Html Markup Generator” needs Professionals Help!

this project is very important for me so i decided to post it here .. with hopes it'll enable me to Draw some Experienced developers attention, as it start to get a little too complex for my skills ...
2
votes
0answers
38 views

Practical advise for CMS

I'm working on a CMS system. The basis is pretty much done but before going any further I would like to know if there are things I really should change in the way I code things. I am pretty sure ...
0
votes
0answers
29 views

Improvements on tree index class

I developed a QuickIndex class which serves to index arrays of stringafiable objects using a tree structure. The purpose is to then primarily to allow for fast index or include? method calls directed ...
0
votes
0answers
32 views

Orginization of Code

So I'm writing an app for android and I'm trying to figure out how to write it more efficiently. If I was writing it in Java, I would have had seperated the code into methods and classes but I'm so ...
2
votes
1answer
51 views

Vectorize or otherwise speed up a double for loop

I have this function containing some loops and a double for loop. What it does is set up a matrix first to store results in (the task at hand is comparing genomes) and then with sliding window, ...
4
votes
4answers
144 views

Largest Palindrome efficiency

I have written an algorithm to find the largest palindrome under a given number, but I am sure my code loses efficiency by creating new arrays in every pass. I am currently learning about efficiency ...
4
votes
2answers
207 views

A code in python3 need help for time efficiency

I need to solve the problem below in python3 (within 3 sec). Problem definition: A is a given (NxM) rectangle, filled with characters "a" to "z". Start from A[1][1] to A[N][M] collect all ...
1
vote
4answers
106 views

Improving performance hacker rank Median

im trying to compete on hackersrank and my awnswer got accepted but the times are not so good, i have a friend who sent the awnser in c# too but somehow made it a lot faster and im wondering what can ...
3
votes
1answer
168 views

Help optimize my HTML/JS Game Engine

So, recently, I've been working on a JS/HTML5 Game Engine. Right now I'm calling it DimSumJs, because like DimSum isn't a full meal, my framework still runs too slowly to make a full game (it can only ...
2
votes
1answer
432 views

Powershell Script for Manipulating Excel Files

I am a newbie at scripting so be easy. I have a directory of xls workbooks with the following naming convention: 001.WIP Monthly Report 002.WIP Joes Custom Report ... 129.PUR Supplier Spend The ...
5
votes
1answer
224 views

Code Review for Hangman in C++

I have the following C++ program: #include <iostream> #include <cstdlib> #include <ctime> #include <vector> void printVector (std::vector<int>& vec) { for (int ...
4
votes
2answers
177 views

How can I memoize or otherwise optimize this code?

The code checks many more conditions like the one below. I was thinking to memoize it, but I can't think about how (writers block). How else could I optimize this? I know it seems silly, but my code ...
-1
votes
0answers
31 views

Using for loop to get the Hamming distance between 2 strings [closed]

So i'm having some trouble with this code. i need to get the Hamming distance (the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols ...
4
votes
2answers
337 views

Querying MYSQL from an external application (is my pascal code inefficient)?

I have a database that I need to query over and over as fast as possible. My queries execute pretty quickly, but there seems to be some additional lag. I have a feeling that this lag is due to the ...
2
votes
1answer
86 views

Help me speed up this Java code. Deals with HUGE list of ints

Below is the code I have written. I started yesterday with prime numbers and playing around with them. What the code does it determines the "prime gap" between primes numbers, prints them, then finds ...
0
votes
1answer
35 views

JavaScript - Does this bookmarklet need some optimization?

I'm working on JavaScript bookmarklet that lets users send a text and link to a site. This is the bookmarklet: ...
0
votes
1answer
70 views

I've finally found a satisfactory way to create classes on JavaScript. Are there any cons to it?

Depending on external OO libraries is really bad, using prototypes/new has some limitations, using only hashes has others. Dealing with classes was always a pain in JavaScript and it didn't help that ...
3
votes
1answer
264 views

Which is better: the short, clever way, or the long, ctrl+c way?

The code below is equivalent. I can see pros and cons for both versions. Which one is better? Short version: character.on("key",function(key){ var action = ({ ...
1
vote
2answers
126 views

Basic PHP comment form: what ways can I improve security, efficiency/cleanliness, or conventionality?

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 ...
1
vote
1answer
98 views

Playing Card Class - is this right?

The Art and Science of Java, a course book that uses the ACM library has an exercise that reads like this. Implement a new class called Card that includes the following entries: • Named ...
1
vote
1answer
38 views

Improve file-path finding method

I am using a recursive algorithm to find all of the file-paths in a given directory: it returns a dictionary like this: {'Tkinter.py': 'C:\Python27\Lib\lib-tk\Tkinter.py', ...}. I am using this in a ...
2
votes
2answers
112 views

How can I improve this coin flipping code?

I am doing exercises for the Art and Science of Java textbook. I had an exercise that required me to program the simulation of flipping a coin until 3 consecutive "Heads" result appeared. I did it, ...
1
vote
1answer
78 views

Add checkbox with label to a form

For a WordPress login form I have written a small plugin. It adds a checkbox with a unique name to the form and if that name is not present in the login POST request it just dies. The idea is ...
1
vote
2answers
65 views

How's my matrix library look?

I've written a short library for manipulating matrices for 3D drawing. I've tried to strike a balance between speed and readability. Anything to improve? %! %mat.ps %Matrix and Vector math routines ...
1
vote
1answer
129 views

Which code is better? And why?

I found two ways of writing the same program (one that only uses local variables, but no methods other than the main one) and other that uses one instance variable that is used in two methods. This ...
0
votes
2answers
123 views

Better code indentation

I'm sure code indentation is a basic requirement for correct development. I have checked out may pages to learn more and results of my coding are below. I like to share that here to receive opinions ...

1 2 3 4 5 12