speed

Deeper understanding on loops (for, while, do while, foreach, recursion, etc.)

If givin some situation that you can do a loop of a certain event or function that needed to be solved using loops, where you can achieve these by any kind of loop. How can we determine the difference between each loops that can be used based on their speed, efficiency, and memory usage? Like for example, you have these loops for(int...

Threaded execution speed of LOCK CMPXCHG

I wrote a multi-threaded app to benchmark the speed of running LOCK CMPXCHG (x86 ASM). On my machine (dual Core - Core 2), with 2 threads running and accessing the same variable, I can perform about 40M ops/second. Then I gave each thread a unique variable to operate on. Obviously this means there's no locking contention between the th...

best search algo

What is the best search algo that has least worst case of execution time and is memory efficient. I'm looking for a data structure that can store lots of data within least memory possible and also is quickest to search for any item. This is for a scenario where i have few entries of form say A(name,value) pairs. and there are other entri...

C libcurl - measure download speed and time remaining

Hi, I am using the following code to download files from the internet: size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) { size_t written; written = fwrite(ptr, size, nmemb, stream); return written; } int main(int argc, char** argv) { FILE *downloaded_file; if ( (downloaded_file = fopen (download_path ...

Why should I use python 3.1 instead of python 2.6 ?

Hello, After reading some benchmarks, I noticed that python 3.1 is slower than python 2.6, especially with I/Os. So I wonder what could be the good reasons to switch to Python 3.x ? ...

subversion very slow

I am working on a project where the branches folder contain at least 300 different branch (copy of the trunk) which is will no more be used. Since SVN is running more and more slowly I wonder if deleting those branches will make subversion behave operate faster? Other people in my team say that since the source code will still be on the...

I have a huge set of elements and jQuery's each() function is killing my browser - How can I improve my code?

I'm using two plugins I wrote to find all the radio/checkbox inputs and select boxes in a form and them style them. I now have a large form which a lot of checkboxes and Firefox is hanging as my plugin tries to style each of them. Here's the plugin code: (function($) { $.fn.stylecheck = function(options) { /* Para...

Speed, CouchDB views and alternatives

Hello, I have large data set, which I want to query. The query does not change but the underlying data does. From what I read, I could construct a "view" and query it. Also, I read that Couch DB knows how to update the view when data is changed so I assume querying the view again would be still fast. My questions are, do I understand C...

best way to find webcontrols quickly

Request.Form[key] has a hashtable-like interface, but I doubt that's how it works. Is there a hashing mechanism for the current Page control set? How would one pass along a hashed set of all controls between postbacks? ...

Is a C++ program really slower than a similar C program?

Assume that i have written a program in C++ without using RTTI and run-time polymorphism (no virtual function, no virtual inheritance) and classes don't have private/protected members, also the C++ specific header files are not used (i.e. C header files are used: cstring, cstdio, ... instead of string, iostream, ...). Then i want to wri...

Java compile speed vs Scala compile speed

I've been programming in Scala for a while and I like it but one thing I'm annoyed by is the time it takes to compile programs. It's seems like a small thing but with Java I could make small changes to my program, click the run button in netbeans, and BOOM, it's running, and over time compiling in scala seems to consume a lot of time. ...

how do things like maven-cli-plugin / mvnsh speed up the maven build?

sorry for being dumb here, but I failed to see why these tools can speed up the build. for example (if I understand it correctly), maven-cli requires you to do a build once: clean, compile, install, then it speeds up your build by caching the clean and compile phrase, so you can execute the install phrase only over and over. at my firs...

iPhone/iPod coregraphics speed

Hi, I'm writing a piece of software for the iPhone/iPod. I've tested it on the simulator and lately using my first gen. iPod touch. To my surprise the code is a bit sluggish on the iPod device. My program (using core graphics) draws a large background image, a couple of other images, a large radial gradient fill, uses transparency (alp...

OpenRowSet, OpenQuery, OpenDataSource - which is better in terms of performance

This can be a debatable answer, but I'm looking for the case where a local Excel file needs to be exported to a local SQL Server 2008' table. Has anyone ever had the chance to check execution time to compare OpenRowSet/OpenQuery/OpenDataSource for a very large file import in SQL Server 2008? I'm able to use any of the 3 options, and th...

Speed of looking up .NET Dictionary value by key?

I have a dictionary of 10000 Product/Colour/Size combinations which I have created with something like: AllRecords = DB.ProductColourSizes _ .ToDictionary(function(b) String.Format("{0}_{1}_{2}", _ b.ProductCode, b.ColourCode, b.SizeCode)) So an example key is like "13AI_GRS_M" I have to sync up my database ...

Quickly remove first n lines from many text files

I need to create an output text file by deleting the first two lines of the input file. At the moment I'm using sed "1,2d" input.txt > output.txt I need to do this for thousands of files, so am using python: import os for filename in somelist: os.system('sed "1,2d" %s-in.txt > %s-out.txt'%(filename,filename)) but this is quite slo...

MySQL - Why is COUNT with "greater than" quick but "less than" takes forever?!

SELECT count(*) c FROM full_view WHERE verified > ( DATE (NOW()) - INTERVAL 30 DAY) If I run that query it takes a split second but if I switch the comparison operator around it takes eons. Now the first way the count = 0 and the second way the count = 120000, but if I just count the whole table that also takes microseconds. But there...

JQGrid Redrawing is slow

Hey Everybody! So i've had JQGrid in my application for a while now and the speed of the grid hasnt really bothered me up until I started optimization. If find that even if I have a small grid (20 items per page) the hover highlighting is slow and if the grid happens to need a scroll bar on the page, the scrolling of the page is really...

Simulating Slow Internet Connection

I know this is kind of an odd question. Since I usually develop applications based on the "assumption" that all users have a slow internet connection. But, does anybody think that there is a way to programmatically simulate a slow internet connection, so I can "see" how an application performs under various "connection speeds"? I'm not ...

How much overhead do decorators add to Python function calls

I've been playing around with a timing decorator for my pylons app to provide on the fly timing info for specific functions. I've done this by creating a decorator & simply attaching it to any function in the controller I want timed. It's been pointed out however that decorators could add a fair amount of overhead to the call, and that ...