speed

Tips on optimizing javascript

The things I'm trying to get my website to do are getting fairly complex, some of the things that need to be done take long enough that it gives visible delays. Mainly, adding content to the document slows things down as well as jquery animations that I'm using. I create elements using document.createElement("div") rather than just doi...

n-th prime number problem, need to speed it up a bit

There is simple cipher that translates number to series of . ( ) In order to encrypt a number (0 .. 2147483647) to this representation, I (think I) need: prime factorization for given p (p is Prime), order sequence of p (ie. PrimeOrd(2) == 0, PrimeOrd(227) == 49) Some examples 0 . 6 (()()) 1 () ...

Changing the speed of a circular motion

I'm looking for a way to smoothly increase or decrease the speed of a circular movement. Using the parametric equation of a circle, I can move an object in a circle over time: x = center_x + radius * sin(time * speed) y = center_y + radius * cos(time * speed) The problem with this approach is that I can't simply do speed = speed + 1 ...

How to smoothly animate Windows Forms location with different speeds?

I've been trying to smoothly animate some Windows Form location but I'm having some issues if I want the speed to be variable. In other words, if I want to allow the user to select the preferred speed for animation. I've found the following article that helped me quite a bit to perform the animation I was looking for, for my form. It se...

Autocomplete server-side implementation

What is a fast and efficient way to implement the server-side component for an autocomplete feature in an html input box? I am writing a service to autocomplete user queries in our web interface's main search box, and the completions are displayed in an ajax-powered dropdown. The data we are running queries against is simply a large ta...

When to Be Specific About the Type of List You Want

Let's say I have a class which, internally, stores a List of data: import java.util.List; public class Wrapper { private List<Integer> list; public Wrapper(List<Integer> list) { this.list = list; } public Integer get(int index) { return list.get(index); } } For the sake of this example, pretend it's a usefu...

Under what circumstances is it advantageous to give an implementation of a pure virtual function?

In C++, it is legal to give an implementation of a pure virtual function: class C { public: virtual int f() = 0; }; int C::f() { return 0; } Why would you ever want to do this? Related question: The C++ faq lite contains an example: class Funct { public: virtual int doit(int x) = 0; virtual ~Funct() = 0; }; inline Funct::...

Math equation to calculate different speeds for fade animation

I'm trying to add a fade effect to my form by manually changing the opacity of the form but I'm having some trouble calculating the correct value to increment by the Opacity value of the form. I know I could use the AnimateWindow API but it's showing some unexpected behavior and I'd rather do it manually anyways as to avoid any p/invoke...

How to get network interface speed programactically on Linux?

I am wondering about the speed as show in the network connection information, e.g. 100Mb/s, 10Mb/s, not the available bandwidth. Thanks in advance! ...

Connection speed test in Silverlight

I'd like to put some sort of "connection quality" indicator on a Silverlight 3 app that would give the user an idea of their connection speed. This could be an icon that turns red, yellow or green to give a basic idea of the performance the user should expect. What's a good way to measure connection speed in Silverlight? ...

.Net 3.5 CompactFramework Stack

All, I need a high speed stack on a .Net CF platform (ARM chip). Does anyone know if the standard (managed) queue classes work well enough for what I describe below? Anyone got an idea on how fast they are? If I do not used managed memory classes what should I use? The stack will need a maximum size (in megabytes ... 10 or 20 ... so mem...

Could this tile blitter get any faster?

When I make a tile-based map editor in C#, I tend to iterate over the X,Y axes and call Graphics.DrawImage() to blit a single tile in place, from a tileset Bitmap onto a map Bitmap. This process takes several seconds to complete, so I only do it once when loading a new map or changing its tileset. Any edits from there on are relatively f...

Routing image requests to separate subdomains

First, a bit of background info: The HTTP 1.1 specification, circa 1999, recommends that browsers and servers limit parallel requests to the same hostname to two. (more) If you carry on reading that article the author suggests "fooling" browsers by having multiuple subdomains all pointing to the same thing. If I was to serve my im...

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...

SQL Server 2005 Clustered Index Query Speed

Our sites are getting pounded pretty hard so we're taking a look into optimizing some of our existing queries. While looking into this we ran across several queries whose execution plan was about 4-5 times faster when a simple reference of the clustered index is in the query... for example If this was the old query: SELECT ... FROM my...

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...

BLAS daxpy and dcopy when inc=1, are they any faster than just using a(:,t) = b(:,t)?

Well the title says it, I'm doing following kind of operations in Fortran: a(:,t) = b(:,t) c(:,t) = x(i,t)*d(:,t) Is there any benefits of using daxpy and dcopy subroutines from BLAS in this case where inc=1? ...

How can I speed up this histogram class?

This is supposed to calculate the histogram of an 8-bit grayscale image. With a 1024x770 test bitmap, CreateTime ends up at around 890ms. How can I make this go (way, way) faster? EDIT: I should mention that this doesn't actually compute the histogram yet, it only gets the values out of the bitmap. So I really should have asked, what...

Speed of calculating powers (in python)

I'm curious as to why it's so much faster to multiply than to take powers in python (though from what I've read this may well be true in many other languages too). For example it's much faster to do x*x than x**2 I suppose the ** operator is more general and can also deal with fractional powers. But if that's why it's so much slowe...

Why does the second for loop always execute faster than the first one?

I was trying to figure out if a for loop was faster than a foreach loop and was using the System.Diagnostics classes to time the task. While running the test I noticed that which ever loop I put first always executes slower then the last one. Can someone please tell me why this is happening? My code is below: using System; using System....