I have a file which has a many random integers(around a million) each seperated by a white space. I need to find the top 10 most frequently occurring numbers in that file. What is the most efficient way of doing this in java?
I can think of
1. Create a hash map, key is the integer from the file and the value is the count. For every numb...
I need to add the [Serializable] attribute to a class that is extremely performance sensitive.
Will this attribute have any performance implications on the operation of the class?
...
In my test I created a string with 32000 characters.
After repeated execution of the test the BCL StringReader consistently executed in 350us while mine ran in 400us. What kind of secrets are they hiding?
Test:
private void SpeedTest()
{
String r = "";
for (int i = 0; i < 1000; i++)
{
r += Randomization.GenerateString(...
Hey all,
I have a magento shop (ver 1.2) running under a dedicated LAMP setup.
I have made the following changes to it:
Enabled magento caching
Enabled APC
MySQL Query caching
GZip compression of html,css,js
The shop is still incredibly slow, around 10 secs and over for rendering the homepage. Is there any obvious things I am missi...
Following on from my other post about primary keys I am wondering if there is a performance impact in using a string value as the key in WPF comboboxes. For example
<ComboBox x:Name="TestCB" ItemsSource="{Binding Path=Products}" DisplayMemberPath="ProductName"
SelectedValuePath="ShortCode" SelectedValue="{Binding Pat...
Hi folks,
I'm wanting to find out how many requests/sec my asp.net mvc site (and asp.net mvc api) can handle. I've googled for some help and stumbled on this great slide show which talks about exactly the things i'm after. They also use a product called ApacheBench to hit the website. That application's website list it as a unix-type pr...
I am trying to optimize this sort of things in a heavy computing application:
say I have a
double d[500][500][500][500];
and the following is quite costly at least from compiler perspective
double d[x][y][j][k]
I want to tell compiler is that it's contiguous memory, to facilitate computing the offset.
In my example,
I have s...
Hi,
We have some code which produces an RTF document from a RTF template. It is basically doing string search and replaces of special tags within the RTF file. This is accessible via a web page.
Typically, the processing time for this is really quick.
However, we need to embed an image within a template. We've been embedding these ...
I'm working on an experimental implementation of Goldenthal et.al's inextensible cloth algorithm in C#.
First I used Math.NET Iridium to assemble and solve the matrices, but quickly replaced this with dnAnalytics since the latter allows me to reuse matrices, almost eliminating further memory allocation, which is important for real-time...
Hi,
I am developing an asp.net application where user inputs set of document number in excel sheet and my application should search for the particular records in the database and return the records which contains the value that was made as an input.
For example if the document number which was given as input is "2245678"
In database t...
In Oracle, when querying for row existence, why is Select 1 fast than Select count(*)?
...
Swing newbie question...
I have a system where there is a large number of independent widgets in the window (think >100) getting asynchronous updates and then requesting a repaint. When these widgets get updates very very fast, they seem to overload the Swing event thread so that user interaction (e.g., right clicking to display the con...
My team has some data stored in a database which other teams in our company are interested in getting, and we're planning to build some web services, so that they don't have direct access to our database.
We aren't running very complex queries (consider it instant, once we're interested in the overhead), and we're wondering how long a w...
If I have code like this:
string s = MyClass.GetString(); // Returns string containing "hello world";
ProcessString(s);
Is this any slower than?
ProcessString(MyClass.GetString());
If so, why? In the second example, is the compiler generally making a variable from the GetString(); method which returns a string?
Also, what is the b...
I'm writing an ASP.NET web service using C# that has a DoLookup() function. For each call to the DoLookup() function I need my code to execute two separate queries: one to another web service at a remote site and one to a local database. Both queries have to complete before I can compile the results and return them as the response to t...
In short I have 2 tables:
USERS:
------------------------
UserID | Name
------------------------
0 a
1 b
2 c
CALLS:
------------------------
ToUser | Result
------------------------
0 ANSWERED
1 ENGAGED
1 ANSWERED
0 ANSWERED
ect ect (i use a numerical referance for result in reality)
I have over ...
I'm working on a complex page with multiple scripts, css files, lots of dynamically generated html, scripts loading scripts, all kinds of crazy stuff. Naturally, the page can load quite slow sometimes.
I'm finding it difficult to tell, in realtime, what exactly is slowing it down. Can FireBug's "net" tab help me with this? I've looked ...
Let's say for example we've got a SIMPLE eCommerce system, with two separate systems: an Inventory Management System (IMS) and an Order Management System (OMS). Assume IMS provides information around inventory (getItem, getItemQuantities etc) and OMS provides ordering services (startOrder, addItemToOrder, finalizeOrder etc)
These two s...
Lately I have been experiencing Eclipse Galileo (3.5) slowing down under Java 1.5b12 OR Java 1.6b10, every 10 to 15 minutes for about 30 seconds, it hits a 90-95% CPU load. The progress view shows nothing, however.
I'm suspecting a plugin is causing issues, but what I'd need is some tool or plugin to monitor Eclipse for what it is doing...
My application has to deal with large amounts of data, usual select size is about 10000 rows. In order to improve performance it is recommended only to select the data needed.
When i have to do calculations or any meaningful business i am comfortable with selecting all the data in order to instantiate my model correctly so i can rely on...