optimization

postgres daily query analysis tool

does anyone know of a postgres view / function / tool that could report on the slowest and most often used slower queries? i think this would be so useful for all sysadmins. thanks! ...

How should mysql be optimized/tuned for lots of writes and few reads (100:1). Read perf reqd.

I have simple db with 4 tables with a few millions rows each, and several indexes. I'm performing several hundred update and inserts on them per minute. The reads are much less frequent, but they need to be fast - for a web app. The reads should have priority - I can delay writes, if it helps improve the snappiness of reading. Curren...

C# Code optimization

who could be faster ? and why ? 1: Point point = new Point(25,25); //any numbers.. Point point2 = new Point(20,95); //any numbers.. Graphics g = CreateGraphics(); g.DrawLine(point,point2); OR 2: Graphics g = CreateGraphics(); g.DrawLine(new Point(25,25),new Point(20,95)); ...

Which one is less costly in terms of resources?

Im on an optimization crusade for one of my sites, trying to cut down as many mysql queries as I can. Im implementing partial caching, which writes .txt files for various modules of the site, and updates them on demand. I've came across one, that cannot remain static for all the users, so the .txt file thats written on the HD, will nee...

Fastest way to loop through a 2d array?

Hey folks, I just stumbled upon this blog post. The author shows two code samples that loop through a rectangle and compute something (my guess is the computing code is just a placeholder). On one of the example, he scans the rectangle vertically, and on the other horizontally. He then says the second is fastest, and every programmer sh...

The Logistics Side of Using Multiple Sub Domains for Static Content

It's generally considered a best practice to serve static content, such as images and css, from different sub domains (images1.domain.com, images2.domain.com, etc). I've seen this discussed in detail in various places, however I'm concerned about the general logistics of this in terms of maintainability. Our site has thousands of pages...

quadratic assignment problem

is there any software to solve quadratic assignment problem. ...

Sharepoint Search Property Weighting

I'm using the code listed here: http://msdn.microsoft.com/en-us/library/ms553069.aspx With an additional line added as a call to .update() after the property is set in order to save the changes, but even with a weight of 10,000 the search results for my property are still at the bottom, particularly below title. Is there some other thi...

How to find all naive ("+" based) string concatenations in large Java codebase?

We have a huge code base and we suspect that there are quite a few "+" based string concats in the code that might benefit from the use of StringBuilder/StringBuffer. Is there an effective way or existing tools to search for these, especially in Eclipse? A search by "+" isn't a good idea since there's a lot of math in the code, so this ...

Algorithms for Optimization with Fast Disk Storage (SSDs)?

Given that Solid State Disks (SSDs) are decreasing in price and soon will become more prevalent as system drives, and given that their access rates are significantly higher than rotating magnetic media, what standard algorithms will gain in performance from the use of SSDs for local storage? For example, the high random read speed of SS...

Optimizing a simple query on two large tables

I'm trying to offer a feature where I can show pages most viewed by friends. My friends table has 5.7M rows and the views table has 5.3M rows. At the moment I just want to run a query on these two tables and find the 20 most viewed page id's by a person's friend. Here's the query as I have it now: SELECT page_id FROM `views` INNER J...

Need help optimizing my 2d drawing on iPhone

Hello, I'm writing a game that displays 56 hexagon pieces filling the screen in the shape of a board. I'm currently drawing each piece using a singleton rendering class that when called to draw a piece, creates a path from 6 points based of the coordinate passed in. This path is filled with a solid color and then a 59x59 png with an alp...

Hiding Table Columns With JQuery

This method is used to hide columns in a table based on a collection of metadata json objects. There is an object per column in the table. Currently on a table that has ~500 rows and ~15 columns with 6 being hidden this method takes ~2 seconds to execute. I am attempting to optimize it to be faster. Any suggestions? function hideHidden...

how to improve SQL query performance in my case

Hello everyone, I have a table, schema is very simple, an ID column as unique primary key (uniqueidentifier type) and some other nvarchar columns. My current goal is, for 5000 inputs, I need to calculate what ones are already contained in the table and what are not. Tht inputs are string and I have a C# function which converts string in...

Coalesce function for PHP?

Many programming languages has a coalesce function (example). PHP, sadly, does not. What would be the most efficient way to implement one in PHP? ...

Does C# Collection Initialization Syntax Avoid Default Initialization Overhead

When you use the new C# collection initialization syntax: string[] sarray = new[] { "A", "B", "C", "D" }; does the compiler avoid initializing each array slot to the default value, or is it equivalent to: string[] sarray = new string[4]; // all slots initialized to null sarray[0] = "A"; sarray[1] = "B"; sarray[2] = "C"; sarray[3] = ...

.NET 3.5 optimizations after converting from 2.0 to 3.5

I converted our project from .NET 2.0 to 3.5 and am looking for optimizations that can be done utilizing 3.5 framework. What are some of the things I can do with 3.5 as in Datastructures. Also any suggestions in using DataAccess apart from LINQ to SQL. Any suggestions/pointers would be great. I am not looking at any specific optimization...

Whats the advantage of using a constructor function in a JavaScript object?

What's the advantage of using a constructor function like so: var MyLibrary = new function(){ var self = this; self.MyLibrary = function(){ // init code } } Instead of simply writing code inside the object? var MyLibrary = new function(){ // init code } ...

Best practices for getting a list of IDs from an ActiveRecord model

I have an ActiveRecord model Language, with columns id and short_code (there are other columns, but they are not relevant to this question). I want to create a method that will be given a list of short codes, and return a list of IDs. I do not care about associations, I just need to end up with an array that looks like [1, 2, 3, ...]. M...

django- pass a string or an instance in urls.py?

Is there a benefit to passing a string in your url patters vs a function instance? It seems like it could be optimized to not actually load the function until it is needed, but is this in fact true? from django.conf.urls.defaults import * from myapp.views import myView urlpatterns = patterns('', # as a string url(r'^as-string/$...