performance

Database design with table sharing

My application saves posts to database, I have 6 different types of posts and I delibrately NOT joining these post tables with any other tables. Now, they all share some common columns, like, PostID, UserID, Title, Body, PostDate, ViewCount, and many more common columns... And, these 6 types of posts have many of their own unique c...

Why is fseeko() faster with giant files than small ones?

I'm getting some strange performance results here and I'm hoping someone on stackoverflow.com can shed some light on this! My goal was a program that I could use to test whether large seek's were more expensive than small seek's... First, I created two files by dd'ing /dev/zero to seperate files... One is 1 mb, the other is 9.8gb... Th...

How to reduce Garbage Collection performance Overhead

MY application profiling showing a big Garbage Collection overhead. The profiler does'nt have a drill down into the Garbage Collection. What should I do to reduce this overhead? I have many short-living arraylists and some long-lived that only die when the application shuts down. ...

I'm looking for an efficient C object serialization Mechanism.

I'm looking for an efficient way to implement a serialization mechanism in C. I know it would be simple to just store the data in JSON, for example, and then reinitialize everything during the parsing. But I'm wondering if it is possible (or worth it) to write something that will just take my struct (containing dynamically allocated da...

What's the most efficient way to test two integer ranges for overlap?

Given two inclusive integer ranges [x1:x2] and [y1:y2], where x1 <= x2 and y1 <= y2, what is the most efficient way to test whether there is any overlap of the two ranges? A simple implementation is as follows: bool testOverlap(int x1, int x2, int y1, int y2) { return (x1 >= y1 && x1 <= y2) || (x2 >= y1 && x2 <= y2) || ...

::std::vector::at() vs operator[] << surprising results!! 5 to 10 times slower/faster!

During program optimization, trying to optimize a loop that iterates through a vector, I found the following fact: ::std::vector::at() is EXTREMELY slower than operator[] ! The operator[] is 5 to 10 times faster than at(), both in release & debug builds (VS2008 x86). Reading a bit on the web got me to realize that at() has boundary che...

Optimizing memory footprint of a .NET application with a huge number of instances

I have an application that holds huge number of instances in-memory for performance reasons, and I don't want to write it to disk or any other place, just hold it all in-memory. public class MyObject { public string Name; public object Tag; public DateTime DateTime1; public DateTime DateTime2; public DateTime DateTi...

What's the best to check if item exist or not: Select Count(ID)OR Exist(...) ?

What's the best in performance to determined if an item exist or not specially if the table contain more than 700,000 row if (Select count(id) from Registeration where email='[email protected]') > 0 print 'Exist' else print 'Not Exist' OR if Exists(Select id from Registeration where email='[email protected]') print 'Exist' else ...

Is Oracle's site slower than Sun's?

Thanks to the ubiquitous fast Internet, I've gotten in the habit of using Google to search for Java API docs, rather than digging through the online the API docs or the copy I have stored locally for speed. Looking for a class like Pattern (was that in java.util or java.text? If I knew, I wouldn't have to go searching for it!), I just Go...

Use of the public static field, good programming practice/fast?

Hello all, I'm programming a big game in Java and I'm trying to optimize the code but also to keep the code neat and well organized. Now I am unsure if I should use the public static field of single classes that have a couple of variables that are used by a lot of instances. For example the class camera has an x and y position that d...

iPod App runs slower on 32GB model than on 8GB model

Hi all, I have a big performance problem on 32GB iPod touch model 3rd generation. The App is a port of an DS 3D game. The rendering is done with OpenGL ES 1.1. It uses OpenAL for Audio and the MPMoviePlayerController for videos. The performance on a 8GB iPod touch is fine, it runs constantly with more than 30 fps. Then I tested it on ...

Help with a possible performance problem (in a php pagination)

Hello I have a search engine, but in the pagination I have to redefine the searchterm in the url, I mean <a href='http://mysite.com/search.php?q=searchTerm&amp;currentPage=2'&gt;Next&lt;/a&gt;. Please tell me if I'm doing it well or there is another way to do it ...

what's bubble sort good at?

Possible Duplicate: What is a bubble sort good for? I'am sure every algorithm has its advantage and disadvantage, so how about buble sort compared to other sorting algorithm? (ofcourse I hope the answer is other than "easy to learn") ...

Information sought on filesystems and high-performance memory-mapped data stores on Windows

I've recently acquired responsibility for a critical system which is a data store featuring memory-mapped IO, multi-threaded (local) clients, and an interesting mixture of constraints. It has to store a mix of serial and indexed data including sparse 3D data of varying levels of detail. Performance is critical, including being able to w...

Tools for analyzing performance of a Haskell program

While solving some Project Euler Problems to learn Haskell (so currently I'm a completly beginner) I came over Problem 13. I wrote this (naive) solution: --Get Number of Divisors of n numDivs :: Integer -> Integer numDivs n = toInteger $ length [ x | x<-[2.. ((n `quot` 2)+1)], n `rem` x == 0] + 2 --Generate a List of Triangular Values ...

Disable javascript function based on user's computer's performance

My website has a jQuery script (from http://www.bitstorm.org/jquery/shadow-animation/) which constantly changes the colour of box shadow of various <div>s on the home page. The animation is not essential but does take up a lot of CPU time on slower machines. Is it possible to find out if the script will run 'too slowly'? I can then di...

What is the Clojure equivalent of a "public static final" constant in Java

I'm writing some Clojure code that depends upon a number of constants. They will be used within tight inner loops, so it's important that they will be used and optimised as efficiently as possible by the Clojure compiler+JVM combination. I would normally used a "public static final" constant in Java for the same purpose. What is the be...

Creating AJAX Rich Mobile Site?

I'm thinking about creating a mobile website that's rich in AJAX and Jquery functionality. So from the phone, a user can experience capabilities such as: drag and drop, "loading..." images, dialogs that fade in and fade out, drop shadow dialog boxes, dynamic resizing of dialogs etc... When the mobile website first loads, it will probab...

Optimize lucene search performance

I have an application that store (title,body) of a news as separate field in lucene document At search time i need to create a query that boost title over body. (title is more important in search) but it slow down the speed of searching. An optimization tip show me that I can combine these two fields into one and It absolutely speed up s...

Detect system load with emphasis on "swap thrashing" in Linux

I crafted a Bash prompt that, When the working directory is a Git repository, displays the name of the current repository. Besides, it contains the current ongoing task and the time spent doing it (from a homebrew timekeeping tool). This, of course, means that just displaying the prompt means running two processes. This has the drawback...