speed

Numpy and line intersections

How would I use numpy to calculate the intersection between two line segments? In the code I have segment1 = ((x1,y1),(x2,y2)) and segment2 = ((x1,y1),(x2,y2)). Note segment 1 does not equal segment2. So in my code I've also been calculating the slope and y-intercept, it would be nice if that could be avoided but I don't know of a way...

Comparing XML documents for changes in PHP

Currently I'm using PHP to load multiple XML files from around the web (non-local) using simplexml_load_file(). This, as you can imagine, is quite a clunky process and is slowing load time significantly (7 seconds to load 7 files), and there could possibly be more files to load. These files don't change often, but changes should be displ...

Analog speedometer

Can some bode give me tutorial to make analog speedometer with Android? I have currently speed (get by GPS), but I don't know the graphic part. Thabks ...

Regular expression performance in Java -- better few complex or many simple?

I am doing some fairly extensive string manipulations using regular expressions in Java. Currently, I have many blocks of code that look something like: Matcher m = Pattern.compile("some pattern").matcher(text); StringBuilder b = new StringBuilder(); int prevMatchIx = 0; while (m.find()) { b.append(text.substring(prevMatchIx, m.start()...

Java vs. PHP Speed Comparison

Which language is faster for web, Java or PHP? ...

How do I calculate velocity with Core Location?

hi , i need to get the speed of my device (meters per seconds) and this is my code the speed is always 0 i don't understand. - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{ double gpsSpeed2 = newLocation.speed; labelm.text = [N...

give the job to MySQL or to PHP?

I have some several codes in PHP to do jobs that MySQL could do. such as sorting, merging each data from different MySQL tables, etc... Lately, I found out that I can do all these stuffs with one MySQL query. I am wondering is it better to give the MySQL capable jobs to MySQL or to PHP. efficiencies, speed, etc.. Thank You, ...

Periodically check if android GPS has new data

I have successfully been getting GPS data through the registerLocationListener() and onLocationChanged() methods. The only problem with this is that the speed reading of my app freezes if there is no more GPS data (e.g. when I go indoors, enter a tunnel, etc). The behavior I want for my app is that the user is somehow notified that the s...

quickest way to dynamically retrieve image dimensions

One way to improve page loading is to specify image dimesions (hieght width). In PHP this can be done with getimagesize(), however I can imagine this would be quite slow to execute if you have alot of images. What is the best way to dynamically get image dimensions of many images with minimal effect on page loading. We are talking about...

ruby fast reading from std

What is the fastest way to read from STDIN a number of 1000000 characters (integers), and split it into an array of one character integers (not strings) ? 123456 > [1,2,3,4,5,6] ...

How can I speed up my PHP based website?

I just built a small PHP based site from scratch, yay for me! But given the size of it, it's running a little slower than I expected. I have the files/folders organized like this: articles [folder] css [folder] html [folder] images [folder] js [folder] photography [folder] resources [folder] articles.php [file] bio.php [file] ...

Need help adding Expires headers

Hello everybody, So basically I've ran my site through ySlow and it has informed me that I should add Expires headers to some of the elements on my page to help with the caching. The page is mainly static content currently hosted on an Apache/2 server. If it helps at all the site is here. I'm not really sure how you alter the HTTP i...

Can I make GIF animation frames play faster in ActionScript?

like say i have a gif that has 10 frames. what is the code that will help me make the gif go through those frames at a quicker pace? ...

simplexml_load_file() speed factors.

Hi, I'm working on a web-app, in which each user has multiple non-local XML files that are downloaded and parsed via SimpleXML each page (re)load. Each request takes a little less than a second on average, however with more than five or six files (which is likely), the load time is quite noticeable. So my question is what factors go into...

SQL efficiency - [=] vs [in] vs [like] vs [matches]

Just out of curiosity, I was wondering if there are any speed/efficiency differences in using [=] versus [in] versus [like] versus [matches] (for only 1 value) syntax for sql. select field from table where field = value; versus select field from table where field in (value); versus select field from table where field like value; ...

Why does Jquery animation speed up after first run?

I'm making a basic marquee that takes a set of list items and scrolls them (this is for a sports site, they want a news ticker). Everything works except after the first run the duration speeds up. var duration = 10000; var textScroll = function(toScroll, time) { toScroll.animate({left:"-"+toScroll.children().text().length+"px"...

Why < is slower than >=

Hi all, I am using the following code to do the test and it seems like < is slower that >=., does anyone know why? import timeit s = """ x=5 if x<0: pass """ t = timeit.Timer(stmt=s) print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) #0.21 usec/pass z = """ x=5 if x>=0: pass """ t2 = timeit.Timer(stmt=z) pr...

Fast Arc Cos algorithm?

I have my own, very fast cos function: float sine(float x) { const float B = 4/pi; const float C = -4/(pi*pi); float y = B * x + C * x * abs(x); // const float Q = 0.775; const float P = 0.225; y = P * (y * abs(y) - y) + y; // Q * y + P * y * abs(y) return y; } float cosine(float x) { return sine...

Speeding up an IO bound OpenGL application

Hi guys, I've been working on a point cloud player lately that should be ideally able to visualize terrain data points from a lidar capture and display them sequentially at around 30fps. I, however, seem to have come to a wall resulting from PCI-e IO. What I need to do for every frame is load a large point cloud stored in memory, then...

Speed of inheritance in php

Hi, I wonder what is the speed price of using inheritance in php. ...