performance

How can I tell if cookies are being set on my domain?

I've been doing a lot of reading on how to optimize website performance. Both Google and Yahoo advocate using cookie-less domains; I've also read about setting up subdomains to achieve the same effect. My question is: is there a way to determine if cookies are being set at the *.example.com level versus the www.example.com level? I have...

Ways of Efficiently Seeking in Custom File Formats

I've been wondering what kind of ways seek is implemented across different file formats and what would be a good way to construct a file that has a lot of data to enable efficient seeking. Some ways I've considered have been having equal sized packets, which allows quick skipping since you know what each data chunk is like, also preindex...

If I have an array of keys M, and an array of targets N, how can I verify that M[i] exists in N before searching it?

Like the title says, I'm trying to find elements of M that exist in the large constant array N. Most of the time, no element of M will exist in N, so the vast majority of searches done on M are a waste of time. I'm looking for some way to create an index to check before doing a full-scale search of M. A project similar to mine creates a...

Event Delegation in jQuery 1.4

I've got the following code: $("ul.relatedAlbums li").hover(function(){ $(this).css({fontWeight:"bold"}); }, function(){ $(this).css({fontWeight:"normal"}); }); I've heard good things about event delegation and speed performance. Using jQuery's delegate method, I imagine it would go something like: $("ul.relatedAlbums").deleg...

Haskell math performance on multiply-add operation

I'm writing a game in Haskell, and my current pass at the UI involves a lot of procedural generation of geometry. I am currently focused on identifying performance of one particular operation (C-ish pseudocode): Vec4f multiplier, addend; Vec4f vecList[]; for (int i = 0; i < count; i++) vecList[i] = vecList[i] * multiplier + addend; ...

First HttpWebRequest in a fresh AppDomain is slow, but not always

I'm trying to understand a performance issue I'm having when creating new AppDomains and executing HttpWebRequests in these. Have a look at my Host.exe: private static void Main(string[] args) { for (int i = 0; i < 3; i++) { AppDomain domain = AppDomain.CreateDomain("Foo"); try { Console.Wri...

Why is calling a function (such as strlen, count etc) on a referenced value so slow?

I've just found something very strange in PHP. If I pass in a variable to a function by reference, and then call a function on it, it's incredibly slow. If you loop over the inner function call and the variable is large it can be many orders of magnitude slower than if the variable is passed by value. Example: <?php function TestCoun...

performance test of DOM operations via innerHTML

According to spirit of stackoverflow (thanks to @Bill the Lizard clarifying this) I would like to introduce small own research of the well known to all front-end web developers question. How to get better performance of jscript while programming DHTML, using innerHTML or DOM operations? For the testing I have created single HTML page ...

Will using factory methods in .NET COM Interop increase performance?

I'm working on a VB6 application that consumes .NET objects via COM Interop. The application is working well, but I feel like I'm taking a performance hit each time I instantiate a .NET object from within VB6. For example, I have VB6 code that loops through a recordset and instantiates new .NET objects for each item in the recordset an...

Mysql Activity Union Query

Hi guys, right to business. I have an activity feed which gets all different kinds of activity from different parts of my site sorts them all out by means of using UNION and an ORDER BY and then a LIMIT to get the top 25 and then displays the activity. My fellow programmer says that we will run into problems when we have more rows (cur...

Contains is faster than StartsWith?

A consultant came by yesterday and somehow the topic of strings came up. He mentioned that he had noticed that for strings less than a certain length, Contains is actually faster than StartsWith. I had to see it with my own two eyes, so I wrote a little app and sure enough, Contains is faster! How is this possible? DateTime start = D...

What's the most efficient way for accessing a single record in an ADO recordset?

I want to access individual records in a classic ADO recordset without enumerating over the entire recordset using .MoveNext. I'm aware of using AbsolutePosition as well as .Filter =. What's the best way? More Details: I'm likely going to be accessing the recordset several times pulling out individual records that match a list of reco...

jQuery Clone Performance

I've read that javascript gets significant performance benefits from modifying off-dom. Earlier today, I was reading the clone documentation: "Note that when using the .clone() method, we can modify the cloned elements or their contents before (re-)inserting them into the document." Is the implication then that if I have 1,...

Using of deeply nested pointers

Suppose we have to use in some function deeply nested pointer very extensively: function (ptr_a_t ptr_a) { ... a = ptr_a->ptr_b->ptr_c->val; b = ptr_a->ptr_b->ptr_c->val; ... } Assuming all pointers are checked and valid, is there performance degradation, problems with atomicity or other caveats (except readability) in...

Out of memory when migrating models

I am migrating data from one model version to another in the iPhone, but the migration causes the device to run out of memory and crash. Not to mention it takes forever on the device. I use the default migration settings. I guess the bad guy is one of the tables that contain the order of 105 rows. This table has not changed though, but ...

Clojure number crunching performance

I'm not sure whether this belongs on StackOverflow or in the Clojure Google group. But the group seems to be busy discussing numeric improvements for Clojure 1.2, so I'll try here: http://shootout.alioth.debian.org/ has a number of performance benchmarks for various languages. I noticed that Clojure was missing, so I made a Clojure ve...

VS2010 profiler seems to not resolve symbols from ngen'd images

I'm profiling a Windows service by attaching to it in the 'sampling' mode. I open the results file, the "functions" view and I see the "hottest" function being displayed as [System.Runtime.Serialization.ni.dll] without indication of the concrete .net function inside this assembly. It looks like all other symbols from ngen'd assemblies...

Javascript && operator versus nested if statements: what is faster?

Now, before you all jump on me and say "you're over concerned about performance," let it hereby stand that I ask this more out of curiosity than rather an overzealous nature. That said... I am curious if there is a performance difference between use of the && ("and") operator and nested if statements. Also, is there an actual processi...

Run-time compilation: How is it possible that this isn't a performance hit?

I've heard that some types of runtime compilation aren't a performance hit. The official Python documentation asserts that running a .pyc file is no faster than .py. (I can't find the link right now.) How is this possible? Doesn't it take time to generate bytecode from the .py? What about languages like PHP? Isn't it necessary to compil...

Eclipse to get program execution time

OS:WinXP Under UNIX-like environment, we can get execution time by $time ./my_program. I wonder we can get execution time info in Eclipse? Is it possible to do this without a profiler? Thanks. ...