# Tag Info

1

These stats are for the Model I, and is for two 10 digit numbers. The Model I did in fact use table look ups for math, except for divide (add table was at locations 300-399, multiply at 100-299). The Model II had circuitry for addition and subtraction, but still used table look up for multiply. As odd as all of that sounds what you would find most odd was ...

0

The wikipedia section you posted has a reference which links to a document. That document states that the IBM 1620 Data Processing System could multiply 10 digit numbers in 17,700 microseconds (17,7 ms) Nor clear whether it's the multiplication of two ten-digit numbers or that the number of digits of both operands add up to ten ( like 1000 * 100000 ).

0

The IBM 1620 was an inexpensive (lower end model around \$88k USD circa 1959) scientific computer that did all arithmetic (including addition and multiplication) via table look-up. Thus multiplication, requiring multiple look-ups, was quite slow (many milliseconds per). However, computers that could do arithmetic operations faster, at that time, were far ...

0

From the previous column in that table, the "1620" is the IBM 1620. https://en.wikipedia.org/wiki/IBM_1620 And yes it means multiplying two numbers.

-2

If working in a compiled language excessive branching can mess with your processor's pipelining so if the 2 logical expressions are simple( e.g. "X<=10 & X >=1") you would be better off not using a short circuiting "and" (&&) or multiple if statements. But some optimizing compilers do this for you.

2

0

Some inspiration of what is possible can be found on these existing Performance Dashboards. Unfortunately, not all of them are free software, and neither of them seems to be ready-to-use by others: https://datazilla.mozilla.org/ http://goperfd.appspot.com/perf http://speed.pypy.org/ https://chromeperf.appspot.com/

4

The inefficiency/messiness is coming from "hydrating" your data too early and too often. By "hydrating," I mean instantiating data objects from (what I assume are) records in your database. You don't always need to deal with data objects. For example, with this code... \$posts = Posts::getPosts(); // get the ids into an array \$post_ids = array(); ...

3

When you loaded the definition for your own max function into ghci, you may have not noticed that ghci indicated that it was interpreted (something along these lines): Prelude> :l mymax.hs [1 of 1] Compiling Main ( mymax.hs, interpreted ) Ok, modules loaded: Main. In order to really benchmark performance, compile your definition with ghc ...

2

What is the best way to get a grip on intended and unintended performance changes in such a setup? I don't know anything about your benchmark suite, but as far as I understand the question, this can be implemented as an automatic test (I assume you have already a test suite with integration or acceptance tests in place). What you need is a ...

2

I believe that the best approach for your case is using Jenkins with the Performance Plugin. It has nice graphs and can be used both with JMeter and SoapUI. Also test performance is important. According to Martin Fowler it is better to run fast unit tests for every commit and slow integration and performance tests every few hours.

2

I have a limited amount of experience with Jenkins. One thing I really liked about it was the dashboard display that had been set up by my colleagues, using plugins for Jira, Subversion, and Clover (code coverage). Jenkins supports quite a number of plugins and you can develop them yourself. I know that Hudson has a similar extensibility.

3

Fragment is a modular section of an Activity that has it's own lifecycle, receives its own input events, which you can add or remove while the activity is running (sort of like a "sub activity" that you can reuse in different activities) Apart from the obvious advantage of using fragments, UI optimization across different screens, it lets you manage ...

0

Bit manipulation in Python is possible (if you mean the standard bit operations like AND OR XOR etc.), but you cannot change arbitary memory by design. You can use Cython (http://cython.org/) however, which is a extended dialect of Python which compiles to C.

1

I don't think having a bunch of printlns is a design issue at all. The way I see it is that this can clearly be done with static code analyzer if it is really a problem. But it is not a problem because most people don't do IOs like this. When they really need to do lot of IOs, they use buffered ones (BufferedReader, BufferedWriter, etc..) when the input is ...

1

While the performance is not really an issue here, the bad readability of a bunch of println statements points to a missing design aspect. Why do we write a sequence of many println statements? If it were just one fixed text block, like a --help text in a console command, it would be much better to have it as a separate ressource and to read it in and write ...

3

Another answer gave an excellent overview over how you'd nicely encapsulate the row-oriented storage and give a better view. But since you also ask about performance, let me address that: SoA layout is not a silver bullet. It's a pretty good default (for cache usage; not so much for ease of implementation in most languages), but it's not all there is, not ...

1

You might want to check whether you can still use some sensible abstractions and use e.g. the template method pattern to write understandable code for the common functionality and move the differences between the methods into the "primitive operations" (according to the pattern descrition) in 12 subclasses. This will mightily improve maintainability and ...

1

What you have described is an implementation problem. OO design is expressly not concerned with implementations. You can encapsulate your column-oriented Ball container behind an interface that exposes a row- or column-oriented view. You could implement a Ball object with methods like volume and move, which merely modify the respective values in the ...

0

As usual, the answer is "it depends". There's lots of different ways you can do it, each solution will vary depending on your unique situation. I have found that windows tends to barf at any more than 1000 files per directory, so in the past I have created a folder per 1000 files. But you could split it by starting character (eg alphabetically)... or create ...

1

In higher level languages like C and C++, this is less of a problem than in Java. First of all, C and C++ define compile-time string concatenation, so you can so something like: std::cout << "Good morning everyone. I am here today to present you with a very, " "very lengthy sentence in order to prove a point about how it looks strange " ...

25

There are two 'forces' here, in tension: Performance vs. Readability. Let's tackle the third problem first though, long lines: System.out.println("Good morning everyone. I am here today to present you with a very, very lengthy sentence in order to prove a point about how it looks strange amongst other code."); The best way to implement this and keep ...

3

Short answer: you are fully correct, and articles like this one are completely missing this point. The full answer is: the "Structure-Of-Arrays" approach of your examples can have performance advantages for some kind of operations ("column operations"), and "Arrays-of-Structs" for other kind of operations ("row operations", like the ones you mentioned ...

5

Sometimes, the specification of an algorithm is based on bit operations. This is especially true in crypto work. Crypto has another attribute to it that is important - that the operation takes exactly the same amount of time no matter what the parameters are. This is to try to avoid leaking any data with timing attacks (there are even attacks based on the ...

0

There is absolutely nothing wrong with the 'problem' you mentioned. From what I know this is the exact kind of design and approach used by DB server to have good performance. They have lot of special methods to make sure they can maximize the performance for all kinds of operations: join, select, aggregate, etc... when certain conditions apply. In short, ...

0

I was after the same thing a came to the conclusion that is it permutations that I wanted and this "algorithm to generate permutations explained" did what I wanted. The example is in Ruby but it is quite easy to understand (and quite simple). Edit: From the mentioned website above: First things first, the basics: Permutations are how many times a set ...

1

Many mathematical operation (such as division, multiplication, etc.) are supposed to be computed faster when dealing with power of two numbers. For instance 15 * 256 = 0x0e right shifted (fast) 8 bits = 0x0e00 = 3840 Whereas 15 * 255 = 0x0e multiplied by (slow) 0xff = 0x0ef1 = 3825 Does this kind of optimization even happen in SQL Server? ...

1

No sane Java method can be long enough to have 12 variants... and JITC hates long methods - it simply refuses to optimize them properly. I've seen a speed up factor of two by simply splitting a method into two shorter ones. Maybe this is the way to go. OTOH having multiple copies may make sense even if there were identical. As each of them gets used in ...

-2

How old is the program? Most probably newer hardware would remove the bottleneck and you could switch to a more maintainable version. But there needs to be a reason for maintenance, so unless your task is to improve the codebase, leave it be as it is working.

8

Really make sure than under real, production, conditions (realistic memory consumption, that triggers Garbage Collection realistically, etc), all those separate methods really make a performance difference (as opposed to having only one method). This will take a few days out of your time, but may save you weeks by simplifying the code you work with from now ...

-1

If the function in question is large, turning the "mode/paradigm" bits into an interface and then passing an object that implements that interface as a parameter to the function can work. GoF calls this the "Strategy" pattern, iirc. If the function is small, the increased overhead may be significant... did somebody mention profiling yet?... more people ...

20

This is a very bad situation, you need to refactor this ASAP - this is technical debt in it's worst - you don't even know how important the code really is - only speculate that it's important. As to solutions ASAP: Something that can be done is adding a custom compilation step. If you use Maven that is actually fairly simple to do, other automated build ...

15

Is the maintenance hit real, or does it just bother you? If it only bothers you, leave it alone. Is the performance issue real, or did the previous developer only think it was? Performance problems, more often than not, are not where they are thought to be, even when a profiler is used. (I use this technique to reliably find them.) So there is a ...

6

Why not include some sort of template preprocessor\code generation for this system? A custom extra build step that executes and emits extra java source files before compiling the rest of the code. This is how including web clients off of wsdl and xsd files often works. You'll of course have the maintenance of that preprocessor\code generator, but you ...

4

The potential problem is performance and you don't have a performance problem, yet. There are many things you can do depending on the database of choice to handle this in solution #1: indexing, hardware, caching, etc. This all depends on how frequently the user needs to get a current unread message count. Many of these choices don't require custom coding on ...

8

The textbook solution acccording to database theory would be to have no values in your database which depend on the values of other data, because these are transitive dependencies. Having fields which are computed values based on other fields is a violation of normalization, because it leads to redundant information. However, sometimes what the textbook ...

0

The way I would do it is by executing a query every time, i.e. your second approach. Just make sure you add an index in your message table on the column that acts as a foreign key to the users table to improve the performance of your query. Then as Doc says, measure the performance of this approach and then you will be able to tell whether you need to take ...

12

How is this normally done or whats the better approach? The best approach is to try it first without an extra field, measure the performance, and if it really turns out to be too slow, you try to optimize. This could mean to switch to your first approach using an extra field, but you should consider to test other options as well, for example, putting an ...

1

On Windows, at least, guard pages are considered too "expensive" to use them for every allocation. So guard pages are more of a backup. They are only used for large allocations. Also, they cause problems for 32-bit applications, because they consume virtual memory address space. You can read more here: Software Defense: mitigating heap corruption ...

2

You are right - there is no way to guarantee that the method would be inlined - MSDN MethodImplOptions Enumeration, SO MethodImplOptions.AggressiveInlining vs TargetedPatchingOptOut. Programmers are more intelligent than a compiler, but we work on a higher level and our optimizations are products of one man's work - our own. Jitter sees what's going during ...

4

Compilers are smart beasts. Usually, they'll automatically squeeze out as much performance as they can from anywhere they can. Trying to outsmart the compiler doesn't usually make a big difference, and has a lot of chances to backfire. For instance, inlining makes your program bigger as it duplicates the code everywhere. If your function is used in a lot of ...

0

I presume we're talking about Java by the link. You're right of course. The tradeoff is speed vs development time / hassle. A popular logging library called log4j takes a classname or string as a initialization parameter. Successive logging performed by the class will automatically offer the class name as possible information to output into the log ...

0

Use a different channel on a message queue for each consumer. For each line in one of your big files write a message to each channel (e.g. each consumer). Each consumer can process messages on its channel deleting the messages once received.

0

Why did algorithm S do better at beating humans than algorithm H? Because S was a better model of human behaviour. The obvious difference is that S (Shannon) had a short memory and H (Hagelbarger) had one that was longer. We can hypothesise that humans play this game with more short term than long term consistency. Obviously to check our hypothesis will ...

Top 50 recent answers are included