performance

How do I create a Load Balancer sort of logic using PHP?

Hello all, I wish to make use of my unlimited shared hosting to create several small shared hosting accounts that I can offload processing to. So I need to create some logic in PHP to create the basics of a Load Balancer. I have 4 shared accounts, one is the main site and the other 3 is the processing server accounts. Please see image....

mapping of a contained struct with boost

Considering these two structs: struct point { int x,y; }; struct pinfo { struct point p; unsigned long flags; }; And a function, that changes a point: void p_map(struct point &p); Is it possible to use boost (e.g. boost::bind or boost::lambda) to create a function equivalent with: void pi_map(struct pinfo &pi) { p_map...

Does the speed of a programming language matter for web applications?

I see a lot of benchmarks between PHP, Python, Ruby, etc all over the Internet. Ruby has gotten a lot of flak for being super slow, which leads to developers refusing to use it for web development for "performance reasons". But does the performance of the interpreter really matter for web applications? Isn't the bottleneck located in the...

How to make jpeg compression with lowest CPU usage?

Hello, I need to convert raw image data to jpeg. But I don't need anything special in terms of best quality, or minumum size etc. Only thing I need is minumum CPU usage. I am new to jpeg compression. Can you please advice about which parameters will have the lowest CPU usage while converting jpeg? I would like to use IPP(intel perform...

Why is my Primary Key slowing down my queries?

Hello, i'm using SQL Server 2008 and, in one of my tables, i implemented a (clustered) primary key on its identifier. Here's the table description: Identifier: - IdentifierId int NOT NULL PK - Alias nvarchar(200) - DataType int NOT NULL I made two indexes: one for Alias and another one for DataType. However, I just noticed somethin...

Java Large Files Disk IO Performance

I have two (2GB each) files on my harddisk and want to compare them with each other: Copying the original files with Windows explorer takes approx. 2-4 minutes (that is reading and writing - on the same physical and logical disk). Reading with java.io.FileInputStream twice and comparing the byte arrays on a byte per byte basis takes 20...

Private Shared Variables vs Local Variables / Namespace Pollution vs Performance?

Reviewing code, I came across a number of new Private Shared variables (of type Hashtables(Of String), initialized in the declaration) added to a partial class for a very large (DataContext-derived) class. This seems sensible to me in one sense because they never change, and making these shared variables ensures that they won't get re-i...

Performance question: String.split and then walk on the array, or RegExp?

I'll do some work on a line separated string. Which one will be faster, to split the text via String.split first and then walk on the resultant array or directly walk the whole text via a reg exp and construct the final array on the way? ...

Optimal way to send mail with SmtpClient?

I'm looking for good performance when sending a lot of e-mails. I have heard that the right way to do it is to open a connection send ~20 e-mails and close the connection. And do that over and over again. Is this correct? And how does SmtpClient work, does it open a connection for it's own lifetime? (not IDisposable, so doesn't look li...

C#: Exact time measurement for performance testing

What is the most exact way of seeing how long something, for example a method call, took in code? The easiest and quickest I would guess is this: DateTime start = DateTime.Now; { // Do some work } TimeSpan timeItTook = DateTime.Now - start; But how exact is this? Are there better ways? ...

Entity Framework: Doing large queries

Hi, I'm probably addressing one of the bigger usability-issues in EF. I need to perform a calculation on a very big part of a model. For example, say we need a Building, with all of its doors, the categories of those doors. But I'd also need the windows, furniture, roof etc. And imagine that my logic also depends on more coupled table...

Performance Counter Logs - Migrating lots of them from Win 2000 to Win 2003

Hi all I have a bunch of performance counter logs setup on a Windows 2000 machine that I would like to move lock, stock and barrel to a Win 2003 machine on the same network. I can't see a way to export that details of all the perf logs and import them, so any ideas on where to look under C:\WINNT for the raw perf log configurations wo...

Refactoring or Rewriting Monolithic PHP Spaghetti Codebase

I've inherited a really poorly designed PHP spaghetti code project. It's been gaining a good bit of traffic recently and is starting to have performance issues on top of the poor monolithic code base. Its maxing out performance on a chunky 16GB dedicated machine when it really shouldn't be. I'm planning on doing some performance twe...

VM Design: More opcodes or less opcodes? What is better?

Don't be shocked. This is a lot of text but I'm afraid without giving some detailed information I cannot really show what this is all about (and might get a lot of answers that don't really address my question). And this definitely not an assignment (as someone ridiculously claimed in his comment). Prerequisites Since this question can...

Efficient way to make a Programmatic Audio Mixdown

I'm currently working on the iPhone with Audio Units and I'm playing four tracks simultaneously. To improve the performance of my setup, I thought it would be a good idea to minimize the number of Audio Units / threads, by mixing down the four tracks into one. With the following code I'm processing the next buffer by adding up the samp...

Mailing Emailing to 50,000-100,000 subscribers

I want to develop a mailing list application that needs to be able to handle out sending messages to 50,000-100,000 subscribers at a time. Can Swiftmailer's batch send method handle this? I am a simpleton when it comes to email/SMTP/mail servers--what are other things I need to keep in mind when developing this application? ...

Does Java optimize method calls via an interface which has a single implementor marked as final?

If I have a reference to a class and invoke a method on it, and the class or the method is final, my understanding is that the compiler or the JVM would replace the dynamic dispatch with a cheaper static dispatch since it can determine exactly which version would be invoked. However, what if I have a reference to an interface, and the i...

System.IO.Ports.SerialPort and Multithreading

Hi, I have some SerialPort code that constantly needs to read data from a serial interface (for example COM1). But this seems to be very CPU intensive and if the user moves the window or a lot of data is being displayed to the window (such as the bytes that are received over the serial line) then communication gets messed up. Consideri...

Which's the best performance between Asp.net MVC controller VS. Wcf for Silverlight Application?

I found that Asp.net Mvc controller can serve both Asp.net Mvc View and Silverlight application via DynamicActionResult(It can be Simple Action Result or Json Action Result depend on request type). So, I have 3 options for creating middle-tier for Silverlight application. Pure WCF Service Every request to WCF must be declare in interfa...

Performance overhead for Hibernate and Spring due to reflection.

Spring and Hibernate uses reflection for bean creation (in case of spring) and POJO mapping (in case of Hibernate). Does it negatively impacts on performance ? Because reflection is slower compare to direct object creation. ...