efficiency

Why is there a performance warning on cast pointer to bool?

Extends. I thought I was being cool when I did something like: bool hasParent() { return this->parentNode ; } Even with a (bool) cast, the warning still doesn't go away. Where this->parentNode is NULL when there is no parent node. But I'm getting: warning C4800: 'Node *' : forcing value to bool 'true' or 'false' (performance w...

Fast, Simple Programmer's Editor

Hi All, Do any of you have any good links that you could share with me? I am looking for a FAST programmers editor that can open a file containing over 100, 000 lines of code really fast? i'm currently using notepad atm and its taking a good 8 seconds to open a file that is 29000 lines long :( i would prefer something that is just like...

php - help improve the efficiency of this youtube style url generator

After some searching I found this youtube style url generator with encryption to hide the original id... however I am hoping to improve the efficiency as it will be used a lot. So far I have improved it by 20%... can anyone help me improve it more. This is the original: function alphaID($in, $to_num = false, $pad_up = false, $passKey =...

Fast conversion of numeric data into fixed width format file in Python

What is the fastest way of converting records holding only numeric data into fixed with format strings and writing them to a file in Python? For example, suppose record is a huge list consisting of objects with attributes id, x, y, and wt and we frequently need to flush them to an external file. The flushing can be done with the followi...

What is the most efficient way to do look-up table in C#

What is the most efficient way to do look-up table in C# I have a look-up table. Sort of like 0 "Thing 1" 1 "Thing 2" 2 "Reserved" 3 "Reserved" 4 "Reserved" 5 "Not a Thing" So if someone wants "Thing 1" or "Thing 2" they pass in 0 or 1. But they may pass in something else also. I have 256 of these type of things and maybe 200 of them...

What are the most efficient idioms for streaming data from disk with constant space usage?

Problem Description I need to stream large files from disk. Assume the files are larger than will fit in memory. Furthermore, suppose that I'm doing some calculation on the data and the result is small enough to fit in memory. As a hypothetical example, suppose I need to calculate an md5sum of a 200GB file and I need to do so with gu...

PHP - Quicker way to do this?

foreach(self::getGroups() as $group) $group_ids[] = $group->getId(); Is there a better, cleaner and more efficient way to do that? Thanks! :-) ...

Which is the best OS (Ubuntu, Windows, Mac, ...) platform to develop Flex Application without headache ?

I believe that OS is Windows or Mac to develop Flex application without headache. I'm working on Ubuntu. I try to use AXDT or Flex Builder 3 for linux to develop AS3. But everytime i change OS to windows when i develop Flex. What is your opinion ? ...

Most efficient tree structure for what I'm trying to do

I'm wondering what the most generally efficient tree structure would be for a collection that has the following requirements: The tree will hold anywhere between 0 and 232 - 1 items. Each item will be a simple structure, containing one 32-bit unsigned integer (the item's unique ID, which will be used as the tree value) and two pointers...

How can I improve my PHP code to make it more efficient?

I've written a simple PHP script which checks if a random value is a valid Rugby Union score. It works quite nicely but isn't particularly efficient, any advice on improving it would be most welcome. $score = rand(0, 60); /* Rugby Union * * Try = 5 points * Conversion = 2 points * Penalty = 3 points * Drop goal = 3 points * */...

Persistent variables on a page in PHP

On a page I am working on, I have several distinct pieces of PHP, such as one in the head to handle dynamic Javascript and one in the main body for table creation. However, many of the operations, SQL queries, etc. are the same between the two area. For example, I keep having to reconnect to the same database over and over. Is there some...

Development time in various languages

Does anybody know of any research or benchmarks of how long it takes to develop the same application in a variety of languages? Really I'm looking for Java vs. C++ but any comparisons would be useful. I have the feeling there is a section in Code Complete about this but my copy is at work. Edit: There are a lot of interesting answers...

Running out of java heap space- 15 puzzle problem.

G'day all, I tried the solution for eight puzzle problem posted here by joel Neely and played around with it and modified it so that can be used to solve for higher grids[Changed the String representation of the grid to two dimensional integer representation and modified the logic accordingly]. However the modified code can solve th...

How can I become good at assembly?

The answer to this question is, of course, "write some assembly code!" But I can do that: I know basic x86 syntax, the types of registers and how to use them, subroutines, etc etc. When I took an assembly class, each assignment had a maximum number of instructions that we were allowed to use. If we went over, then we would lose points ...

Kanban as a Software Development Process in Practice

Has anyone used the kanban method for software development management? I am evaluating kanban as a technique and would be curious to hear from anyone who has actually applied it in practice as to how effective it is. I've seen questions like: is-anyone-using-kanban, kanban-vs-scrum, and apply-kanban-in-an-agile-team but they don't addre...

Why having both str_replace() and preg_replace()?

I came to know PHP after Perl, so when I first found preg_* function I basically just used those. Later I read that str_replace() is faster when dealing with literal text. So my question is, can't preg_replace() be as efficient as str_replace() when the search pattern does not use special characters? Maybe just analyzing the pattern to c...

Best way to load only specfic functions in PHP.

I'm writing my own content management system for a personal website, it's going to be low traffic, but I'd like to use the best practices for my future knowledge. My plan is to have separate sections, basically the first non-root directory, will have it's own script and will directly control all its subpages. I want everything to be con...

When should I call SaveChanges() when creating 1000's of Entity Framework objects? (like during an import)

I am running an import that will have 1000's of records on each run. Just looking for some confirmation on my assumptions: Which of these makes the most sense: Run SaveChanges() every AddToClassName() call. Run SaveChanges() every n number of AddToClassName() calls. Run SaveChanges() after all of the AddToClassName() calls. The fir...

Which way to save custom types to a file on a mobile device?

I have a list of custom types, they need to be saved/loaded to/from a file on a mobile device (Windows Mobile 6) what method would be the most suited, taking into account the limited resources of the device? EDIT: The data file will be around 2-5mb ...

a good book about software design

i'm looking for a book that talks about sofware decision like : when should i use thread pool and shouldn't. and in the first case, explains how. how should i acess my DB , how big my transactions should be how to read XML, to use DOM or SAX, what library to choose, and best ways to parse how to handle client-server app best efficient...