performance

Performance of Computing CRC

#include "windows.h" #include <string> #include <iostream> unsigned long crc32_table[] = { 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B9714...

Most efficient way to grow an array in Java?

Is there a more efficient way to grow a large array than creating a new one and copying over all the values? Like, concatenating it with a new one? What about having fixed-size arrays stored in another array and reallocate / copy that top-level one? Would that leave the actual values in place? I'm aware of ArrayList, but I need a lot o...

Search through a big list fast with jQuery

I'm using this code to search trough about 500 li tags. $(function() { $.expr[":"].containsInCaseSensitive = function(el, i, m){ var search = m[3]; if (!search) return false; return eval("/" + search + "/i").test($(el).text()); }; $('#query').focus().keyup(function(e){ if(this.value.length > 0){ $('ul#abbreviations li'...

In Swing, Is there a way to temporarily freeze repainting of a JComponent containment hierarchy?

If I have a bunch of custom JComponents in a Swing panel, and each of them can contain many other JComponents, is there a way to "freeze" repaints on the top level components and then unfreeze them, triggering a repaint? I guess I am trying to do sort of a localized double-buffering. ...

Getting the min and max values from a PHP array

Is there a built in PHP function that will allow you get the minimum and maximum values from a PHP array? If not, what's the most efficient way of doing this for the general case? ...

Can NullPointerExceptions cause Tomcat performance issues after they've stopped happening?

Hi, all. One of my applications runs on a Windows Service instance of Tomcat 5.5, running Java 1.6. We've got an issue in the code where the application creates a NullPointerException if a SOAP request times out. We had an issue, this morning, where the component on the other side of the SOAP request was unavailable. The result was a...

performance tool

Hi, I basically have a unix process running and it is doing some heavy processing as well as outputting data over the network. I was wondering what system calls are used to interact with the networking layer. I would like to measure the performance metrics of this process: CPU usage, networking usage. I am not sure if this process is b...

Why does .NET use so much CPU, is this a problem?

(This was meant to be a general hypothetical question, me whining that .NET was a pig and begging for reasons. It was not really meant to be a question about my specific app.) Currently I am rewriting some old C++ code in C#. We are porting over all legacy applications. I have C++ applications that take MAX 3% CPU. Mostly they use none....

What happens when Swing's threading policy is violated?

In the past few years I've mostly done UI development in Eclipse, which is very conservative in terms of thread access: any attempt to change a property on a UI widget (e.g., color, text) from outside the UI thread throws an exception. I am now looking at an existing program in Swing that has a window with a large number of custom widge...

Payload performance in Lucene

I know there are several topics on the web, as well as on SO, regarding indexing and query performance within Lucene, but I have yet to find one that discusses whether or not (and if so, how much?) creating payloads will affect query performance... Here's the scenario ... Let's say I want to index a collection of documents (anywhere fr...

Fast way to match an array of words with a block of text?

Hi All, The subject is probably not as clear as it could be, but I was struggling to think of a better way to easily describe it. I am implementing a badword filter on some articles that we pick up from an XML feed. At the moment I have the badwords in an array and simply check the text like so; str_replace($badwords, '', $text, $coun...

How to use two numbers as a Map key

I have two numbers and I want to use them together as a key in a Map. Currently, I'm concatenating their string representations. For example, suppose the key numbers are 4 and 12. I use: String key = 4 + "," + 12; The map is declared as Map<String, Object>. I think this is so bad! I like to use something other than a String as the ke...

Stateless EJBs: Finding the balance between performance and security

I have a JSF web client and a Java client that both use the same stateless EJB layer for their application logic. I'm unsure of how to balance the need for performance (limiting the amount of data that is transported between the presentation and application layers) with security (in the sense of ensuring all decisions are made based on u...

How do I check if my mysql database causes slow down

I have around 3 websites residing in a server which is being shared with other teams. I have been notified that there is a huge increase in CPU usage and we need to lower it down. I doubt my websites are causing this. I have been using SHOW FULL PROCESSLIST in MySQL and 90% of the time shows queries from other databases. But I think ex...

C# Performance setting value for each list item.

Hello, I am trying to find the fasted way to set a specific property of every item in a generic list. Basicly the requirement is to iterate over a list of items and resetting the IsHit property to FALSE. Only the items in a second "hit"-list should be set to TRUE afterwards. My first attempt looked like this: listItems.ForEach(delega...

Slow MSMQ within a WCF service

Hi all, this is a weird thing. I created a simple SOAP based web service with WCF. When the 'SubmitTransaction' method is called, the transaction is being passed on to an application service. But if the application service is not available, it is being written to a MSMQ. Like this: public void SubmitTransaction(someTransaction) { t...

Caching question MySQL or Filesystem

Hi, is there a noticeable speed performance difference when you cache the data which you retrieve from the database to a file on the filesystem (eg.: htdocs/cache/cachefile) rather than grabbing it directy from the MySQL DB? Thanks a lot! ...

Performance differences between P/Invoke and C++ Wrappers

In the process of learning P/Invoke, I asked this previous question: How to P/Invoke when pointers are involved However, I don't quite understand the implications of using P/Invoke in C# over creating a wrapper in Managed C++. Creating the same DLL using P/Invoke in C# definately resulted in a cleaner interface since I could use DL...

Map Clustering Algorithm

My current code is pretty quick, but I need to make it even faster so we can accommodate even more markers. Any suggestions? Notes: The code runs fastest when the SQL statement is ordered by marker name - which itself does a very partial job of clustering the markers (the names of markers in the same location are often, but not alway...

HTTP Caching, Browser Differences

Esteemed Overflow-ers of the Stack, So I've recently been trying to fully wrap my head around HTTP resource caching. Notably, right now I'm looking at simply the caching of a single, sprited image which is used for rendering icons / small images through out the page. Here's an explanation of the odd behavior I'm seeing: So, on the...