1
голосов
3ответов
1514 просмотров

Confusion with the problems of inline function

In the problems of inline functions in wikipedia : http://en.wikipedia.org/wiki/Inline_expansion#Problems it says : "# A language specification may allow a program to make additional assumptions about arguments to procedures that it can no longer make after the procedure is inlined." Could some...

0
голосов
2ответов
1652 просмотров

UNION ALL versus CONNECT BY LEVEL for generating rows

I was wondering which is a better/faster/more efficient way of turning arbitrary strings into columns: UNION ALL SELECT my_field, CASE WHEN my_field = 'str1' THEN ... ... END, ... FROM ( SELECT 'str1' AS my_field FROM DUAL UNION ALL ...

4
голосов
8ответов
746 просмотров

Profiling DLL/LIB Bloat

I've inherited a fairly large C++ project in VS2005 which compiles to a DLL of about 5MB. I'd like to cut down the size of the library so it loads faster over the network for clients who use it from a slow network share. I know how to do this by analyzing the code, includes, and project settings...

0
голосов
2ответов
293 просмотров

Optimizing COUNT(*) query with 4 MM relations and larger table

I am struggling (again) with the table from this question: how to optimize this query (4 mm tables involved) It is one main table product_table which has four MM relations via the lookup tables mm1 to mm4. The lookup tables have the fields uid_local containing the uid of the product_table and...

5
голосов
3ответов
399 просмотров

Dictionary/Client VS Application Variables

Hi i got a question about my server performance ... i got a classic asp cms hosting ~250 websites, for each website we build a Classic ASP dictionary using set dict = CreateObject("Scripting.Dictionary") dict.add "test1","Value Test1" dict.add "test2","Value Test2" dict.add "test3","Value Test...

3
голосов
7ответов
2047 просмотров

How should I optimize this filesystem I/O bound program?

I have a python program that does something like this: Read a row from a csv file. Do some transformations on it. Break it up into the actual rows as they would be written to the database. Write those rows to individual csv files. Go back to step 1 unless the file has been totally read. Run SQL...

1
голосов
1ответов
964 просмотров

best time to SELECT value in Oracle nested query

From an optimization standpoint, I want to know when it's best to SELECT some arbitrary data as columns. Specifically, I have this query: Where do I put this part? SELECT 'String 1' AS segment FROM DUAL UNION ALL SELECT 'String 2' AS segment FROM DUAL UNION ALL SELECT 'String 3' AS segment FRO...

5
голосов
6ответов
761 просмотров

How can I speed up Perl's processing of fixed-width data?

We've got a mature body of code that loads data from files into a database. There are several file formats; they are all fixed-width fields. Part of the code uses the Perl unpack() function to read fields from the input data into package variables. Business logic is then able to refer to these f...

0
голосов
1ответов
1355 просмотров

Help optimize my RPN evaluation function

My parser evaluates PEMDAS expressions by first converting from infix to postfix then uses the standard postfix evaluation rules. I parse the expression and store the tokens in a list. This precompilation is ok for me since I plan on caching the precompiled functions. I am trying to optimize th...

12
голосов
11ответов
758 просмотров

Optimization! - What is it? How is it done?

Its common to hear about "highly optimized code" or some developer needing to optimize theirs and whatnot. However, as a self-taught, new programmer I've never really understood what exactly do people mean when talking about such things. Care to explain the general idea of it? Also, recommend so...

2
голосов
2ответов
1925 просмотров

"Pre-warming" the cache with a full, computationally complex page from my Rails app

Our initial page load is a beast in our Rails app. The great thing about it is the lack of page refreshes needed. The whole thing is very Ajax-y (and our designers made it look great!) There is only one problem: Initial page load is a monster. I have tweaked and prodded and have eeked out incre...

2
голосов
8ответов
2487 просмотров

SQL primary key - complex primary or string with concatenation?

I have a table with 16 columns. It will be most frequently used table in web aplication and it will contain about few hundred tousand rows. Database is created on sql server 2008. My question is choice for primary key. What is quicker? I can use complex primary key with two bigint-s or i can us...

1
голосов
1ответов
440 просмотров

Filter out rows by hardcoded list in MySQL performance

I have a hardcoded list of values like: 1,5,7,8 and so on. And I must filter out rows from table that have ID in list above, so I do something like this: Select * from myTable m left join othertable t on t.REF_ID = m.ID where m.ID not in (1,5,7,8...) But when I have more values (like 1...

3
голосов
3ответов
3146 просмотров

Haskell. Strict application $!

I execute the next code: (take 10) $! [1,2..] What is it ? I thought, ghc will yield a termination, beacause i say "evaluate [1,2..] force". But I got the result "[1,2,3,4,5,6,7,8,9,10]".

22
голосов
6ответов
7454 просмотров

Does Interlocked.CompareExchange use a memory barrier?

I'm reading Joe Duffy's post about Volatile reads and writes, and timeliness, and i'm trying to understand something about the last code sample in the post: while (Interlocked.CompareExchange(ref m_state, 1, 0) != 0) ; m_state = 0; while (Interlocked.CompareExchange(ref m_state, 1, 0) != 0) ; ...

0
голосов
3ответов
183 просмотров

Profiler for a C++ module in a C# app

I rewrote a number-crunching two pages of code from C# to unmanaged C++ in my project, which with full optimizations gave a 3x speedup. I want to keep optimizing that code, but now my profiler of choice, dotTrace, can't do it, because it only looks at managed code. How do I profile the P/Invoked...

53
голосов
8ответов
61835 просмотров

Profiling a Java Application in Eclipse? (plug-in)

I'm looking to find bottlenecks in my Java application in Eclipse. I'm thinking this might be useful: http://www.eclipse.org/projects/project_summary.php?projectid=tptp.performance Any other good plug-ins to use? EDIT OK, it doesn't necessarily have to be an Eclipse plug-in. But it would be ni...

2
голосов
4ответов
204 просмотров

Write a compiler for a language that looks ahead and multiple files?

In my language I can use a class variable in my method when the definition appears below the method. It can also call methods below my method and etc. There are no 'headers'. Take this C# example. class A { public void callMethods() { print(); B b; b.notYetSeen(); public void print() { C...

1
голосов
2ответов
3665 просмотров

Mysql - Stored procedure not using the query cache

I have just converted a SQL select statement into a stored procedure The SQL Statement use select statement takes 0.4784s to run the first time and 0.0003s after that The Stored procedure takes 0.4784s to run every time. I assume the query cache is not been used How can I rectify this? A si...

9
голосов
5ответов
7195 просмотров

SQL left join query runs VERY slow

Basically I'm trying to pull a random poll question that a user has not yet responded to from a database. This query takes about 10-20 seconds to execute, which is obviously no good! The responses table is about 30K rows and the database also has about 300 questions. SELECT questions.id FROM ...

4
голосов
5ответов
4260 просмотров

Comparing arbitrary bit sequences in a byte array in c

I have a couple uint8_t arrays in my c code, and I'd like to compare an arbitrary sequence bits from one with another. So for example, I have bitarray_1 and bitarray_2, and I'd like to compare bits 13 - 47 from bitarray_1 with bits 5-39 of bitarray_2. What is the most efficient way to do this? ...

91
голосов
4ответов
36891 просмотров

Deflate compression browser compatibility and advantages over GZIP

UPDATE Feb 10 2012: zOompf has completed some very thorough research on this very topic here. It trumps any findings below. UPDATE Sept 11 2010: A testing platform has been created for this here HTTP 1.1 definitions of GZIP and DEFLATE (zlib) for some background information: " 'Gz...

36
голосов
8ответов
30419 просмотров

What's the fastest way to iterate over an object's properties in Javascript?

I know that I can iterate over an object's properties like this: for (property in object) { // do stuff } I also know that the fastest way to iterate over an array in Javascript is to use a decreasing while loop: var i = myArray.length; while (i--) { // do stuff fast } I'm wondering...

1
голосов
6ответов
700 просмотров

Program Execution Speed Testing

I have a C# app in which I am testing 3 ways to do something with XML. I read a string of XML get a value out and then add it to a custom collection. I am testing XMLDocument, XDocument and String manipulation to find the node value, in that order recording a start and end time for each. Howev...

0
голосов
1ответов
342 просмотров

How to make Haskell use another list depending on the previous answer in Haskell

I am doing project euler question 63 where I must find the amount of numbers that exist where: x^(n) == y Where n is the length of y. It soon emerges that the results for this condition alternate between odd and even and so I came up with this in Haskell: prob63 = [ n | n <- nums n , i &l...

1
голосов
3ответов
1278 просмотров

Low-level SQL optimisation with Entity Framework

In the past when working with databases I've found it necessary to do low-level tweaks to the query, for example providing hints to the optimiser that it should use a particular index or join order. We are currently considering rewriting our data layer using Entity Framework; is it the case that ...

10
голосов
7ответов
16787 просмотров

How can I optimize/refactor a TSQL "LIKE" clause?

I have a table with 117000 or so records. I need to perform a search that checks 3 separate fields for a given string pattern. My where clause is as follows: field1 LIKE '%' + @DESC + '%' OR field2 LIKE '%' + @DESC + '%' OR field3 LIKE '%' + @DESC + '%' This seems to take about 24 seconds reg...

1
голосов
5ответов
6344 просмотров

What are the advantages/disadvantages of monolithic PHP coding versus small specialized php scripts?

I have historically used a monolithic approach to PHP coding. That is, I write one index.php, with an average size of 70k-250k, and use mod_rewrite to turn the rest of the REQUEST_URI into parameters passed into the index.php to control what is happening. The alternative would be to wr...

1
голосов
4ответов
781 просмотров

What is Java's lightest weight non-concurrent implementation of Iterable?

I need a class that implements Iterable, and does not need to be safe for concurrent usage. Of the various options, such as LinkedList, HashSet, ArrayList etc, which is the lightest-weight? To clarify the use-case, I need to be able to add a number of objects to the Iterable (typically 3 or 4),...

24
голосов
4ответов
9226 просмотров

Optimizing alternatives to DateTime.Now

A colleague and I are going back and forth on this issue and I'm hoping to get some outside opinions as to whether or not my proposed solution is a good idea. First, a disclaimer: I realize that the notion of "optimizing DateTime.Now" sounds crazy to some of you. I have a couple of pre-emptive d...