performance

Is Performance Always Important?

Since I am a Lone Developer, I have to think about every aspect of the systems I am working on. Lately I've been thinking about performance of my two websites, and ways to improve it. Sites like StackOverflow proclaim, "performance is a feature." However, "premature optimization is the root of all evil," and none of my customers have ...

StringBuilder vs String concatenation in toString() in Java

Given the 2 toString() implementations below, which is prefered public String toString(){ return "{a:"+ a + ", b:" + b + ", c: " + c +"}"; } or public String toString(){ StringBuilder sb = new StringBuilder(100); return sb.append("{a:").append(a) .append(", b:").append(b) .append(", c:").append(c) ...

Outlook modify and Save() MailItems - slow

I need to modify many MailItems in Outlook 2007. I need the mails to immediately refresh in the main Outlook grid - the only way to do this I found is to call MailItem.Save(). foreach (var item in folder.Items) { var mail = item as MailItem; if (mail != null) // process only MailItems { setUserProperty(mail, use...

What is the best way to gunzip files with Perl?

Is there a faster solution than my actual 'zcat' solution to gunzip files with Perl? A little benchmark: #!/usr/bin/perl use strict; use warnings; use Benchmark qw(cmpthese timethese); use IO::Uncompress::Gunzip qw(gunzip); my $re = qr/test/; my $bench = timethese($ARGV[1], { zcat => sub { if (defined open(my $FILE, "-|", "zc...

MySQL source file quietly

I have a number of really large files with many insert statements (18.7 million in the largest one). At the mysql> prompt if I do a source file.sql or a ./file.sql everything works good, things get inserted, but there is output for every run statement which ways: Query OK, 1 row affected (0.00 sec). When run this way these inserts can t...

Does order of boolean statements make a performance difference in a MySQL query?

Suppose I want to query a table based on multiple WHERE clauses. Would either of these statements be faster than the other? SELECT * FROM table WHERE (line_type='section_intro' OR line_type='question') AND (line_order BETWEEN 0 AND 12) ORDER BY line_order"; ...or: SELECT * FROM table WHERE (line_order BE...

DBMS Performance-Tuning Book Recommendations

Anyone have any recommendations for books about performance tuning on either frontend or backend? I'm looking specifically for asp.net or sql (MS-SQL) performance tuning, but anything is good to go. Thanks! ...

XmlSerializer Performance Issue when Specifying XmlRootAttribute

I'm currently having a really weird issue and I can't seem to figure out how to resolve it. I've got a fairly complex type which I'm trying to serialize using the XmlSerializer class. This actually functions fine and the type serializes properly, but seems to take a very long time in doing so; around 5 seconds depending on the data in ...

What's your solution for free-text search and sort ?

AFAIK,MySQL performs really bad at this, what's your solution? BTW,what's the solution of SO? EDIT Please pay attention that free-text search itself is pretty fast in MySQL, but not the case when the result also needs to be sorted on an attribute! ...

String capitalize - better way

What method of capitalizing is better? mine: char[] charArray = string.toCharArray(); charArray[0] = Character.toUpperCase(charArray[0]); return new String(charArray); or commons lang - StringUtils.capitalize: return new StringBuffer(strLen) .append(Character.toTitleCase(str.charAt(0))) .append(str.substring(...

Which one is faster?

Which one is faster? SELECT FROM A INNER JOIN B ON A.ID = B.ID ...or: SELECT FROM A , B WHERE A.ID = B.ID ...

Good hash function for permutations?

I have got numbers in a specific range (usually from 0 to about 1000). An algorithm selects some numbers from this range (about 3 to 10 numbers). This selection is done quite often, and I need to check if a permutation of the chosen numbers has already been selected. e.g one step selects [1, 10, 3, 18] and another one [10, 18, 3, 1] the...

Silverlight design pattern for performance - very rich client UI

Following on from this initial investigations on Silverlight architectures, I have some new requirements to consider. We expect our Silverlight client UI to be graphically heavy, with a GIS interface, multiple charts, gauges and datagrids arranged in a Widget style fashion. New widgets will be dynamically generated by the user. Suppos...

Why exactly are non-DB related functions in SQL Server so much slower?

I always hear that non-DB related functions (e.g. string comparison, loops) in SQL Server are slow because, well, it's a database. But why exactly does that fact make these methods crawl in comparison to full programming languages? ...

Improving iPhone performance - loading images from an SQLite3 database

I'm experiencing some performance problems loading about 60 images from a SQLite3 table with the following table: select rowid, thumbnail from my_table where category_id = 4 I have an index on category_id, yet it takes about 2.5 seconds to load a table of 170 70x70 PNG images. In my code, I create an NSMutableArray of objects represe...

Many-to-many relationship structure in SQL Server

Assume that we have two tables: Roles and Reports. And there exists a many-to-many relationship between them. Of course, the only solution that comes to my mind is to create a cross-table, let's name it RoleReport. I can see two approaches to the structure of that table: 1. Columns: RoleReportId, RoleId, ReportId PK: RoleReportId 2....

Performance of MYSQL "IN"

Hi all, I'm running a MYSQL query in two steps. First, I get a list of ids with one query, and then I retrieve the data for those ids using a second query along the lines of SELECT * FROM data WHERE id in (id1, id2 ...). I know it sounds hacky, but I've done it this way as the queries are very complicated; the first involves lots of geo...

What are ways of improving build/compile time?

I am using Visual Studio, and it seems that getting rid of unused references and using statements speeds up my build time on larger projects. Are there other known ways of speeding up build time. What about for other languages and build environments? What is typically the bottleneck during build/compile? Disk, CPU, Memory? What is a li...

Does the length of key affect Dictionary performance?

Hi, I will use a Dictionary in a .NET project to store a large number of objects. Therefore I decided to use a GUID-string as a key, to ensure unique keys for each object. Does a large key such as a GUID (or even larger ones) decrease the performance of a Dictionary, e.g. for retrieving an object via its key? Thanks, Andrej ...

What is the best way to optimize a Windows Server 2008 box running IIS7 to serve only static files?

I would like to have our web applications pull static content (css, js, images) from a static file server running Windows Server 2008 and IIS7. What sort of optimizations would you make to the server for this single purpose? (Machine.config changes? Web.config changes? Special IIS7 setup or modules? What?) ...