speed-up

How to speed-up a simple method (preferably without changing interfaces or data structures)?

I have some data structures: all_unordered_m is a big vector containing all the strings I need (all different) ordered_m is a small vector containing the indexes of a subset of the strings (all different) in the former vector position_m maps the indexes of objects from the first vector to their position in the second one. The string...

Speed up multiple JDBC SQL querys?

I'm working on a shortest path a* algorithm in java with a mysql db. I'm executing the following SQL Query approx 300 times in the program to find route connections from a database of 10,000 bus connections. It takes approx 6-7 seconds to execute the query 300 times. Any suggestions on how I can speed this up or any ideas on a different ...

No speed-up with useless printf's using OpenMP

I just wrote my first OpenMP program that parallelizes a simple for loop. I ran the code on my dual core machine and saw some speed up when going from 1 thread to 2 threads. However, I ran the same code on a school linux server and saw no speed-up. After trying different things, I finally realized that removing some useless printf statem...

Whats faster in Javascript a bunch of small setInterval loops, or one big one?

Just wondering if its worth it to make a monolithic loop function or just add loops were they're needed. The big loop option would just be a loop of callbacks that are added dynamically with an add function. adding a function would look like this setLoop(function(){ alert('hahaha! I\'m a really annoying loop that bugs you every t...

Speed up the loop operation in R

Hi, i have a big performance problem in R. I wrote a function that iterates over an data.frame object. It simply adds a new col to a data.frame and accumulate sth. (simple operation). The data.frame has round about 850.000 rows. My PC is still working about 10h now and i have no idea about the runtime. dayloop2 <- function(temp){ fo...

MySQL: Return grouped fields where the group is not empty, efficiently

In one statement I'm trying to group rows of one table by joining to another table. I want to only get grouped rows where their grouped result is not empty. Ex. Items and Categories SELECT Category.id FROM Item, Category WHERE Category.id = Item.categoryId GROUP BY Category.id HAVING COUNT(Item.id) > 0 The above query gives me the re...

Increasing the Loading Speed of Large Files

There are two large text files (Millions of lines) that my program uses. These files are parsed and loaded into hashes so that the data can be accessed quickly. The problem I face is that, currently, the parsing and loading is the slowest part of the program. Below is the code where this is done. database = extractDatabase(@type).chomp(...

How to use index efficienty in mysql query

Hi: My db is running on mysql v5.x. I have a table T1 with 5 columns and column C1 is the primary key. C1 is of type varchar(20). It contains about 2000 rows with values like: fxg axt3 tru56 and so on.. Now my application's job is to read input data and find if the input data has a starting pattern similar to that found in column C1...

does a wrong src in the img tag overloads the server?

I have this on a very big number of pages: src="//avatar/images/..."; this server is serving zillions of files I was wondering if it's wise to fix that double slash inside the img tag. I would do it at least for an aesthetic point of view, but my question is: "does it affects the http request in some way?" the backend server is Lightt...

What is the best way to update data for an iPhone app?

I am developing an application for iPhone and one part of it deals with a list of currencies and daily exchange rates. I am using SQLite to store all these rates. Now I came to the part where I want to make the update part of my database with the new exchange rates. The first thought was make a request to a server with a specific d...

Flash videos play too quickly

I'm having trouble with Flash-based videos (FLVs, but not SWFs) playing between 5 and 6 times too quickly. My question is, then, some sort of amalgamation of the following (in descending order of importance to me): 1) Is there something I can do to fix (permanently or otherwise) this problem? 2) Does anyone have any idea why this is ha...

What are the advantages and disadvantages of using Nailgun vs netcat to provide fast CLI to a Java application?

The ways to reduce startup time of Java and Scala applications have been already discussed here and here. One of the solutions suggested there was to use client-server approach with either Nailgun or a simple hand-written server communicating through a TCP socket with netcat. On the one hand, Nailgun is designed for this purpose. On the...