performance

How can I measure the performance of a HashTable in C#?

Hello everyone, I am playing around with C# collections and I have decided to write a quick test to measure the performance of different collections. My performance test goes like this: int numOps= (put number here); long start, end, numTicks1, numTicks2; float ratio; start = DateTime.Now.Ticks; for(int i = 0; i < numOps; i++) { /...

Is it possible to retain a variable in memory (RAM) in PHP?

Hello guys, I'm studying high-performance coding for websites in PHP, and this idea popped into my mind: We know that accessing a database uses a significant amount of CPU usage, so we cache such data, saving it to the HDD. But I was wondering, can't it rest in the RAM of the server, so I can access it even more faster? ...

Do you think it is bad to use a lot of CSS3 stuff on a page?

I believe the below css is considered css3 if not then, it's not but my question still applies to the code below. DO you think the code below would hurt a users performance/rendering time or anything if it was used for an example on 50 different images on a page? add curves and shadows -moz-border-radius: 5px; -webkit-border-radius: 5...

MySQL fulltext performance solution

How to deal with queries like : select ... from ... where match(field1) against('someA') and match(field2) against('someB') limit 50 If results returned by condition match(field1) against('someA') & match(field2) against('someB') are both huge,the entire query will be very,very slow. A solution for this? ...

Do multiple entries for the same assembly in web.config cause initial start time to increase?

Can having multiply entries for the same assembly in the web.config cause an increase in the initial start time of an ASP.NET application? For example: <add assembly="ESRI.ArcGIS.ADF.Web.DataSources, Version=9.2.2.1380, Culture=neutral, PublicKeyToken=8FC3CC631E44AD86"/> <add assembly="ESRI.ArcGIS.ADF.Web.DataSources, Version=9.2.2.138...

Performance difference between ++iterator and iterator++ ?

My workmate claims that for object types preincrement is more efficient than post increment e.g. std::vector<std::string> vec; ... insert a whole bunch of strings into vec ... // iterate over and do stuff with vec. Is this more efficient than the next // loop? std::vector<std::string>::iterator it; for (it = vec.begin(); it != vec....

Magento vs. CodeIgniter and writing from scratch

Hi, I need to develop an eCommerce website using PHP. I am not sure if to use Magento or use CodeIgniter and write the site basically from scratch. I have experience with CI and no experience with Magento. My questions regarding Magento: Performance: I read that it has performance issues. Is it the case for the latest version too...

Pre-allocate space for C++ STL queue

I'm writing a radix sort algorithm using queues and I would like to have a STL queue allocate space before I start adding things to the queue so that I can avoid constant dynamic resizing operations. Even though this doesn't exist, I want something with the effect of... queue<int> qs(N); for(int i=0;i<N;++i) qs.push(rand()); in su...

List all performance counters for a category

Is there a built-in method in System.Diagnostics for retrieving all of the instantiated performance counters for a given CategoryName? We have a number of multi threaded apps using custom performance counters and now need to add a dashboard for displaying the performance statistics. I'd like to make the dashboard in such a way that it ...

F#: Why is using a sequence so much slower than using a list in this example

Background: I have a sequence of contiguous, time-stamped data. The data-sequence has holes in it, some large, others just a single missing value. Whenever the hole is just a single missing value, I want to patch the holes using a dummy-value (larger holes will be ignored). I would like to use lazy generation of the patched sequence, an...

How to measure database performance?

I'm developing a web app that will access and work with large amounts of data in a MySQL database, something like a dictionary/thesaurus. I need to test the performance of the DB as its size increases, so I know how slow each request will be in the future. Any ideas? Like are there specific tools to check DB performance for a particular...

Which is better/more efficient: check for bad values or catch Exceptions in Java

Which is more efficient in Java: to check for bad values to prevent exceptions or let the exceptions happen and catch them? Here are two blocks of sample code to illustrate this difference: void doSomething(type value1) { ResultType result = genericError; if (value1 == badvalue || value1 == badvalue2 || ...) { resul...

How to store language tag IDs in databases, as smallint or varchar?

I'm wondering about how to store language tag IDs (e.g. en-US). A quick example: Table l10n ( l10n_id SMALLINT, code VARCHAR(5) ) PK: l10n_id Index on code Table product ( product_id INT, ..language-neutral columns.. ) PK: product_id Table product_l10n ( product_id INT, l10n_id SMALLINT, ..language-specific columns....

When does Erlang's parallelism overcome its weaknesses in numeric computing?

With all the hype around parallel computing lately, I've been thinking a lot about parallelism, number crunching, clusters, etc... I started reading Learn You Some Erlang. As more people are learning (myself included), Erlang handles concurrency in a very impressive, elegant way. Then the author asserts that Erlang is not ideal for nu...

Scala: Mutable vs. Immutable Object Performance - OutOfMemoryError

I wanted to compare the performance characteristics of immutable.Map and mutable.Map in Scala for a similar operation (namely, merging many maps into a single one. See this question). I have what appear to be similar implementations for both mutable and immutable maps (see below). As a test, I generated a List containing 1,000,000 s...

Fast string to integer conversion in Python

A simple problem, really: you have one billion (1e+9) unsigned 32-bit integers stored as decimal ASCII strings in a TSV (tab-separated values) file. Conversion using int() is horribly slow compared to other tools working on the same dataset. Why? And more importantly: how to make it faster? Therefore the question: what is the fastest wa...

How to take advantage of Disk IO queueing

I need to read small sequences of data from a 3.7 GB file. The positions I need to read are not adjacent, but I can order the IO so that the file is read from beginning to end. The file is stored on a iSCSI SAN which should be capable of handling/optimizing queued IO. The question is, how can I make a one shot request of all the data/p...

sproc execution far slower than SQL ad-hoc query equivalent

I have a sproc that was taking far more time than I expected. I pulled out the SQL and ran it with just DECLARED variables for the parameters. It ran nearly instantaneously (versus a reliable 8 seconds with the sproc). This is the same SQL on same machine, returning the same data. How can I figure out and fix what is causing the spro...

How to effectively buffer and flush stream in Open XML SDK

Hello, I use OpenXML SDK 2.0 to generate Excel file with large amount of data, appox. 1000000 rows, and I need to optimize memory usage because my machine slow down very fast. I want to solve this issue by flushing part of generated DOM tree into file in runtime. I make my own buffering for data. E.g I have 100000 records to write an...

Which is better on performance: double quoted strings with variables or single quoted strings with concatenations?

Hello, I know that using single quotes around a string in PHP is faster than using the double quotes because PHP doesn't need to check for variable presence in the single quoted string. My question is which will perform better: A) A double quoted string with variables present: echo "foo bar $baz"; or B) Single quoted with a concaten...