performance

PHP behavior of include/require inside conditional

If I place an include or require statement inside a conditional that evaluates to false, will the PHP interpreter skip the include file altogether, or will it load it just in case? An example would be: if ($some_user_var) { require 'this.php'; } else { //do stuff } I read somewhere that require will always be included by the ...

Max element count in WPF application for performance

Hi, In a WPF line of business application, at which point should I consider that the count of Elements, as seen in snoop, will noticebly hit performance. In Advanced WPF Application Performance, the speaker looks at an application with ~6400 elements and says : fairly heavy but not necessarly unusual. On my part I have an application ...

Computing token counters on huge dataset

I need to go over a huge amount of text (> 2 Tb, a Wikipedia full dump) and keep two counters for each seen token (each counter is incremented depending on the current event). The only operation that I will need for these counters is increase. On a second phase, I should calculate two floats based on these counters and store them. It sh...

To union or union all, that is the question...

I have two queries that I'm UNIONing together such that I already know there will be no duplicate elements between the two queries. Therefore, UNION and UNION ALL will produce the same results. Which one should I use? ...

CouchDB view is extremely slow

Hi All, I have a CouchDB (v0.10.0) database that is 8.2 GB in size and contains 3890000 documents. Now, I have the following as the Map of the view function(doc) {emit([doc.Status], doc); And it takes forever to load (4 hours and still no result). Here's some extra information that might help describing the situation: The view is...

Identify odd, even numbers - binary vs. mod

Recently I had to identify whether a number is odd or even for a large number of integers. I thought of an idea to identify a number as odd or even by AND-ing it against 1 and comparing the result to 1 x & 1 == 1 // even or odd I have never seen this implementation in practice. The most common way you always see is : x % 2 == 0 I...

php refactoring and better coding for php?

i have this process that is the heart of my app, that im creating, but for some reason i feel like its the worst way to do it(instinct) , and i wanted to see if thier is something wrong with this process, and am i approaching it in a bad way! p.s. the code works fine, just refactoring problem. the process is: users go to homepage, they...

Java Regex performance

Hello Everybody. I'm trying to parse links with Regex with Java. But, i think its getting to slow. For example. To extract all links from: http://news.google.com.ar/nwshp?hl=es&amp;tab=wn is spending 34642 milliseconds (34 seconds!!!) Here is the regexp: private final String regexp = "<a.*?\\shref\\s*=\\s*([\\\"\\']*)(.*?)([\\\...

Does "Runtime.getRuntime().exec()" have a bad performance??

Hi there, I want to execute a jar from my own java application. (it's impossible to import that jar a library and start the app as an instance of my own "launcher"). To execute a jar from my own java app...I am using the next lines: String [] cmd = new String [] {"java","-jar","myjar.jar"}; Process process = Runtime.getRuntime().exec(c...

Database design: bigger table vs query the entity for every row in dataTable

I have a table of NewsFeed. NewsFeed + id + fromUserId + targetId + type so the news is like this: Tom Wakefield commented on Peter Smith's profile. So either I add two more fields into my NewsFeed call fromUserName and targetUserName OR For every row I display in my dataTable I would query from the Entity. <p:dataTable value="#{my...

MySQL InnoDB: what are the units for "reads/s"?

In MySQL, I sometimes type "show innodb status" to see that a long-running query is doing something. The bottom has, under "ROW OPERATIONS", a line: 2000.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 2000.00 reads/s What are the units for these? Records? InnoDB pages? OS disk pages? (Are they the same thing?) ...

is it mandatory to optimize the lucene index after write?

Hi, Currently i am calling the optimize method of the indexwriter after the completions of the write. Since my data set is huge, it took long time ( and needs more space (2*actual size)) to optimize the index. I am very much concerned about this because lot of documents included frequently in the index. So is it ok to turn off opt...

Why is accessing dimensions of the image so expensive in JavaScript on IE8?

I have to process loads of images. First, I need to check if the size of the image is greater than 50x60 and appropriately increasing the counter of bad images. The problem I have is that the speed of n.width / n.height on Internet Explorer 8 is extremely low. I checked n.offsetWidth, n.clientWidth but they are all the same speed-wise. ...

Fast loading of PNG image into an array in java

I want to load (and decode) PNG images and convert them into a one-dimensional array in Java. I can obviously do this with ImageIO.read() and then copy the pixels into the array, but that consumes twice the memory (the raster + the final array) and it involves more processing time than I would like. How should I go about this? Worst-cas...

Should I use InnoDB or MyISAM for a "write-only" table?

I have a table where I'm esentially only writing. Think of it as a "transactions" list, where I keep all the details, and I also have a "total" stored in another table. That total is redundant, for performance, but it can be re-calculated if needed from this transactions table. What is better from a performance point of view, keeping ...

For really complex reports, do people sometimes code in their language rather than in sql?

I have some pretty complex reports to write. Some of them... I'm not sure how I could write an sql query for just one of the values, let alone stuff them in a single query. Is it common to just pull a crap load of data and figure it all via code instead? Or should I try and find a way to make all the reports rely on sql? I have a very ...

C# code and SQL Server performance

I have a SQL Server database designed like this : TableParameter Id (int, PRIMARY KEY, IDENTITY) Name1 (string) Name2 (string, can be null) Name3 (string, can be null) Name4 (string, can be null) TableValue Iteration (int) IdTableParameter (int, FOREIGN KEY) Type (string) Value (de...

.NET Target Framework Performance

I have a .NET 4.0 class libary, which only uses .Net 2.0 features. To make this library more compatible with Mono, I'm considering changing the Target Framework to 2.0 instead of 4.0 Client Profile. But the question is: Does changing the Target Framework to an older version, make the library run slower (hurt performance). The GUI of the...

What tools are available for analysing the time a browser spends processing a page.

We are performance tuning our web site at the moment and have the main page content down to a respectable 65ms for firefox to grab it (from request to finish receiving the html). Caching means there is generally no other content that needs to be requested from the server (after the initial page view). However, firefox is spending anoth...

Unused imports in .NET

The VB.Net IDE allows me to scan for unused references. But I also have a lot of unused imports in my application. Is there a way to scan for unused imports in all classes, or does having an unused import not hurt the performance of my application? ...