speed

How can I make my jquery draggable / droppable code faster?

Hi, I've used JQuery to make the elements in a table draggable. (I've never used JQuery before this). It works fine, but is very slow. For example, from the moment I click and hold on an item, to the moment the cursor changes is about 2 seconds. This is on Firefox 3.0.6. Once the item is being dragged, there's a shorter, but still notic...

How many MySQL queries should I limit myself to on a page? PHP / MySQL

Okay, so im sure plenty of you have built crazy database intensive pages... I am building a page that I'd like to pull all sorts of different / unrelated databse information from....here are some sample different queries for this one page: -article content and info -IF the author is a registered user, their info -UPDATE the article's...

Detecting network connection speed and bandwidth usage in C#

Is there a way to detect the network speed and bandwidth usage in C#? Even pointers to open-source components are welcome. Thanks in advance. ...

How to get Google like speeds with php?

I am using PHP with the Zend Framework and Database connects alone seem to take longer than the 0,02 seconds Google takes to do a query. The wierd thing today I watched a video that said Google connects to 1000 servers for a single query. With latency I would expect one server for every query to be more efficent than having multiple serv...

Optimizing the speed of insertion in java.util.Map/Set

Hi all, is there a way to optimize the speed of the insertions in a java.util.Collection by specifying the order of the items ? For example java.util.Set<String> set = java.util.TreeSet<String>(); will this solution: set.add("A"); set.add("B"); set.add("C"); set.add("D"); set.add("E"); be faster than this one (random order) ? set...

Speeding up Ruby script startup in Windows or Cygwin

I've got a ruby script which takes about 30 seconds to startup. It takes that much because it tries to load all libraries and stuff. When I do "ruby.exe -v" it's instant. I don't want to touch the original ruby script, which is not written by me. What are the tricks to speed this process up? Can I precompile it? Can I precache al...

What influences the speed of code?

The way to see how fast your code is going, is performance profiling. There are tools for it and such, but I wonder what the factors are for code speed. For instance, I've been told that image-editting software will use bitwise operations instead of integer variables to calculate their stuff, simply because it's faster. So that must me...

How efficient is std::string compared to null-terminated strings?

I've discovered that std::string's are very slow compared to old-fashioned null-terminated strings, so much slow that they significantly slow down my overall program by a factor of 2. I expected STL to be slower, I didn't realise it was going to be this much slower. I'm using Visual Studio 2008, release mode. It shows assignment of a...

Which is the fastest way to get the absolute value of a number

Which is fastest way to implement a operation that returns the absolute value of a number? x=root(x²) or if !isPositive(x): x=x*(-1) Actually this question can be translated as, how fast is a if(and why please). My college programing professors always told me to avoid if's for they are extremly slow, but I always forgot to ask ho...

Delphi Adding Items to ComboBox Speed

Hi Everyone, I have a fairly complex and large application that hands loads and loads of data. Is there a speedy way to add items to ComboBox that doesn't take so long? On my P3 3.2ghz, the following snippet takes just under a second to add around 32,000 items. (MasterCIList is a StringList with strings typically 20 - 30 bytes long)....

Release vs Debug Build Times

I have always believed that Debug builds are slower than Release builds since the compiler needs to additionally generate debugger information. I was recently surprised to hear one of my colleagues saying that release builds usually take more time. (I believe that it is only because of incremental linking/compiling). In general, which o...

Negative Speedup on Multithreading my Program

On my laptop with Intel Pentium dual-core processor T2370 (Acer Extensa) I ran a simple multithreading speedup test. I am using Linux. The code is pasted below. While I was expecting a speedup of 2-3 times, I was surprised to see a slowdown by a factor of 2. I tried the same with gcc optimization levels -O0 ... -O3, but everytime I got t...

Counting the number of files in a directory using Java

How do I count the number of files in a directory using Java ? For simplicity, lets assume that the directory doesn't have any sub-directories. I know the standard method of : new File(<directory path>).listFiles().length But this will effectively go through all the files in the directory, which might take long if the number of files...

What is the best way to learn Touch Typing?

Duplicate How do I improve my Typing Skills?.** I tried the test on http://speedtest.10-fast-fingers.com/. I reach only: You type 337 characters per minute You have 58 correct words and you have 1 wrong words How can I improve my typing speed? What free resources do you know of? Should I learn the Dvorak Keyboard? ...

Speed up loading of 30-40 dynamically loaded images on each pageview.

I've got a social community with a lot of traffic. In the right column of the site's layout, we got a "online list" that prints out a 40x40px thumbnail pic of friends, people in your area etc. 30-40 images in total. Just before the right column loads, it hangs as all these images are loaded. I need a faster solution compatible down to ...

Faster way to populate <select> with Javascript

I have two <select> boxes on a form. Selecting an item in the first <select> box will determine what should appear in the second <select> (Using Ajax http_request). In some cases there can be a large 500 (guess) items in the second select and it takes time 5-10 seconds to update in IE. Firefox seems to work perfectly. I wonder if th...

Online service to monitor website latency?

We're using Pingdom to monitor our site availability and it's working well. Is there a similar service to monitor website latency? We want to make sure the site not only returns, but is running at a reasonable speed. We've made some internal test pages for monitoring, etc. but it'd be nice to have an external service to verify (especial...

C# Does performance degrade if I use a large ViewState names?

I personally like option one below for maintainability but I could see option two getting me better performance. Option three is probably complete garbage. 1. ViewState["Calendar1.SelectionMode"] = Calendar1.SelectionMode; 2. ViewState["CSM"] = Calendar1.SelectionMode; 3. ViewState["Calendar1_SelectionMode"] = Calendar1.SelectionMode; ...

A better way to replace many strings - obfuscation in C#

I'm trying to obfuscate a large amount of data. I've created a list of words (tokens) which I want to replace and I am replacing the words one by one using the StringBuilder class, like so: var sb = new StringBuilder(one_MB_string); foreach(var token in tokens) { sb.Replace(token, "new string"); } It's pretty slow! Are there an...

Array or List in Java. Which is faster ?

I have to keep thousands of strings in memory to be accessed serially in Java. Should I store them in an array or should I use some kind of List ? Since arrays keep all the data in a contiguous chunk of memory (unlike Lists), would the use of an array to store thousands of strings cause problems ? Answer: The common consensus is that t...