optimization

Is there any point in creating a second column optimized for FULLTEXT searches?

Hi, the project I'm working on has for each column that needs to be searched a second column called "ft[columnname]" which has a FULLTEXT index and only this one is searched against. This column contains an "optimized" text, that is automatically generated from the original column in the following way: The string is lowercased All acc...

How does Hibernate's batch-fetching algorithm work?

I found this description of the batch-fetching algorithm in "Manning - Java Persistence with Hibernate": What is the real batch-fetching algorithm? (...) Imagine a batch size of 20 and a total number of 119 uninitialized proxies that have to be loaded in batches. At startup time, Hibernate reads the mapping metadata and c...

SQL: Filtering groups based on aggregate function

Using MySQL So i'm trying to improve upon a query I've written. My current query works, but i feel like i could be more efficient Essentially, I have a table that lists 'who talks to who and how much'. The records look like this: email name status count prod_ref (I'll post an example set with example output at the end of the...

PHP / SQL (MySQL) function optimization help required

I'm currently trying to optimize a "bottleneck" function that is called really ofen in an application. In the application in question, options can be selected. But some options can be restricted by other. For example, when option "A" is selected, it restricts the selection of option "B". These restriction links are saved to a table whi...

Is micro-optimization worth the time?

Hi, I am a PHP developer and I have always thought that micro-optimizations are not worth the time. If you really need that extra performance, you would either write your software so that it's architecturally faster, or you write a C++ extension to handle slow tasks (or better yet, compile the code using HipHop). However, today a work m...

How to optimise LinqToSQL in c#

hi, i am attempting to update approximately 150,000 records in a table in SQL 2005 using linq2sql. When it comes to xx.SubmitChanges() it is taking about 45 minutes. I am running sql as a local instance on a quad core pc. Does anyone know why this is taking so long? or is that normal? Code Sample: var y = db.x.Where(j => j.NumberOfOr...

Iterating with different integral types

Does it make any difference if I use e.g. short or char type of variable instead of int as a for-loop initializer? for (int i = 0; i < 10; ++i) {} for (short i = 0; i < 10; ++i) {} for (char i = 0; i < 10; ++i) {} Or maybe there is no difference? Maybe I make the things even worse and efficiency decreases? Does using different type ...

Optimizing the Verhoeff Algorithm in R

I have written the following function to calculate a check digit in R. verhoeffCheck <- function(x) { ## calculates check digit based on Verhoeff algorithm ## note that due to the way strsplit works, to call for vector x, use sapply(x,verhoeffCheck) ## check for string since leading zeros with numbers will be lost if (class(x)!="charac...

Optimizing the infragistics wpf datagrid

I should start out with the disclaimer that I don't have a lot of info into this problem, but I wanted to put a feeler out to see if anyone else had this problem. I started a new job and some folks here are using Infragistics WPF datagrid. The grid was selected because of the visual flexibility, but apparently when there are large amount...

What optimizations are premature?

I've been here for nearly a month and it seems that people have a tendency to be eager to use the "Premature Optimization is the root of all evil" argument as soon as someone mentions efficiency. What is really a premature optimization? What is the difference between what is essentially writing a well designed system, or using certain m...

Way to gzip files like CSS, Javascript once and save them for serving to client instead of processing and gzipping every time a request is made

I believe this would be a more CPU friendly method, can it be implemented with php ?, instead of gzipping content for every request, I compress the files once and serve those instead =). ...

Optimize solution for categories tree search.

Hello, I'm creating some kind of auction application, and I have to decide what is the most optimize way for this problem. I'm using BL Toolkit as my OR Mapper (It have nice Linq support) and ASP.NET MVC 2. Background I've got multiple Category objects that are created dynamically and that are saved in my database as a representatio...

SQL optimization/tweaking

I have this SQL Server query SELECT count(distinct [IP]) as GlobalUniqueIPcount, --RangeUniqueIPcount (SELECT count(distinct [IP]) FROM [tblSequence] WHERE SiteID = @siteID AND ([Timestamp] > DATEADD(dd, -@days, (LEFT(GETDATE(),12))))) as RangeUniqueIPcount, --RangeUrlUniqueIPcount (SELECT count(distinct [IP]) FROM [tbl...

Fast float to int conversion and floating point precision on ARM (iPhone 3GS/4)

Hi, I read (http://www.stereopsis.com/FPU.html) mentioned in (http://stackoverflow.com/questions/78619/what-is-the-fastest-way-to-convert-float-to-int-on-x86). Does anyone know if the slow simple cast (see snippet below) does apply to ARM architecture, too? inline int Convert(float x) { int i = (int) x; return i; } To apply some ...

What linux / apache host server settings could be affecting my upload speeds?

Upload speeds to one particular server of mine are drastically slower than expected, or tolerable. I am moving a site to a new host; part of the functionality of the site is the upload of several large (>50Mb) files daily. The current upload speeds are unacceptably slow on the new server. I am new to linux and apache server config...

Which algorithm will be required to do this?

I have data of this form: for x=1, y is one of {1,4,6,7,9,18,16,19} for x=2, y is one of {1,5,7,4} for x=3, y is one of {2,6,4,8,2} .... for x=100, y is one of {2,7,89,4,5} Only one of the values in each set is the correct value, the rest is random noise. I know that the correct values describe a sinusoid function whose parameters a...

Preloading images before CC - per souders

I saw a PPT from steve souders about loading images before the css for a similar situation that i need.... but im not clear on what the actual code is to do this. I assume he loaded something before the css and in his ppt he says this new Image().src = "http://webcelerity.com/blog/wp-content/themes/carrington-blog-faster/images/sprite....

In PL/sql oracle stored procedure,trying to use analytical functions

Is it better to use cursor or analytical functions in a stored procedure for performance improvement? ...

Pass pointer to guaranteed zeroed memory

I need to zero records of varying sizes in a file. To do this, I'm currently allocating dummy records, memseting them to zero, and passing these to a write function. Is there some region which is guaranteed to always be zeroed (and of a large enough size), that I can instead point to, removing the need for repeated allocation and zeroin...

Detect how much stress the mysql database is currently under with PHP

I am developing a large web app and want it to alter itself dependent on a factor that relates to the stress the database is currently under. I am not sure what would me most accurate/effective/easiest. I am considering maybe the number of current connections or server response time or CPU useage? What would be best suited and possible...