optimization

Hotspot JIT optimization and “de-optimization”: how to force FASTEST?

夙愿已清 提交于 2020-01-01 15:52:29
问题 I have a BIG application that I'm trying to optimize. to do so, I'm profiling / benchmarking small elements of it by running them millions of times in a loop, and checking their processing time. obviously Hotspot's JIT is kicking in, and I can actually see when that happens. I like it, I can clearly see things going much faster after the "warm up" period. however, after reaching the fastest execution speed and keeping it for some time, I can see that the speed is then reduced to a less

Best way to initialize a HashMap

断了今生、忘了曾经 提交于 2020-01-01 15:30:26
问题 I usually do e.g. HashMap<String,String> dictionary = new HashMap<String,String>(); I started to think about it, and as far as I know a HashMap is implemented under the hood via a hash table. The objects are stored in the table using a hash to find where they should be stored in the table. Does the fact that I do not set a size on the construction of the dictionary makes the performace decrease? I.e. what would be the size of the hash table during construction? Would it need to allocate new

Is a C++ compiler/linker allowed to remove unused methods?

倖福魔咒の 提交于 2020-01-01 12:27:13
问题 Is a C++ compiler or linker (by any C++ standard) allowed to remove an unused method? Compilers seem to be allowed to remove unused static functions, linkers are allowed to remove unused functions. But i have found no information what it looks like for methods of classes. When the method is virtual this gets really interesting. 回答1: The C++ standard works on a more abstract level. It does not require a C++ implementation to actually be composed of individual tools like a compiler and a linker

Improve SSE (SSSE3) YUV to RGB code

懵懂的女人 提交于 2020-01-01 12:00:35
问题 I am looking to optimise some SSE code I wrote for converting YUV to RGB (both planar and packed YUV functions). I am using SSSE3 at the moment, but if there are useful functions from later SSE versions that's ok. I am mainly interested in how I would work out processor stalls and the like. Anyone know of any tools that do static analysis of SSE code? ; ; Copyright (C) 2009-2010 David McPaul ; ; All rights reserved. Distributed under the terms of the MIT License. ; ; A rather unoptimised set

Apache Spark: How to structure code of a Spark Application (especially when using Broadcasts)

萝らか妹 提交于 2020-01-01 11:59:13
问题 I have a generic question concerning the structuring of code in Java Spark applications. I want to separate the code for the implementation of Spark transformations from the calling on RDDs so the source code of the application stays clear even when using lots of transformations containing lots of lines of code. I'll give you a short example first. In this scenario the implementation of a flatMap transformation is provided as an anonymous inner class. This is a simple application that reads

Garbage from other linking units

こ雲淡風輕ζ 提交于 2020-01-01 11:47:12
问题 I asked myself the following question, when I was discussing this topic . Are there cases when some unused code from translation units will link to final executable code (in release mode of course) for popular compilers like GCC and VC++? For example suppose we have 2 compilation units: //A.hpp //Here are declarations of some classes, functions, extern variables etc. And source file //A.cpp //defination of A.hpp declarations And finally main //main.cpp //including A.hpp library #include "A

User Defined Functions in Excel and Speed Issues

馋奶兔 提交于 2020-01-01 10:53:31
问题 I have an Excel model that uses almost all UDFs. There are say, 120 columns and over 400 rows. The calculations are done vertically and then horizontally --- that is first all the calculations for column 1 are done, then the final output of column 1 is the input of column 2, etc. In each column I call about six or seven UDFs which call other UDFs. The UDFs often output an array. The inputs to each of the UDFs are a number of variables, some range variables, some doubles. The range variables

User Defined Functions in Excel and Speed Issues

坚强是说给别人听的谎言 提交于 2020-01-01 10:53:29
问题 I have an Excel model that uses almost all UDFs. There are say, 120 columns and over 400 rows. The calculations are done vertically and then horizontally --- that is first all the calculations for column 1 are done, then the final output of column 1 is the input of column 2, etc. In each column I call about six or seven UDFs which call other UDFs. The UDFs often output an array. The inputs to each of the UDFs are a number of variables, some range variables, some doubles. The range variables

Optimal covering with non-uniform discs

喜夏-厌秋 提交于 2020-01-01 10:32:06
问题 What kind of algorithm can I use to search for an optimal (minimum area) covering of a limited region of the XY plane with n discs ( x j , y j , r j ) ? I've found many investigations on fixed radius discs, but nothing about variable radius. n is fixed but the discs can be placed freely (they're not in assigned positions and their centers are not required to be inside the region). The region is in general non-connected and non-simply connected (can be composed by multiple parts and can have

a faster way to achieve what intersect() is giving me?

百般思念 提交于 2020-01-01 09:46:33
问题 I am finding that a lot of time spent in my matlab function is in this code: intersect(freq_bins, our_bins); Both can be rather large vectors, and are comprised of only integers. I just need to know which integers are in both. This is truly the primitive purpose of intersect(), so I suspect that the answer is: it doesn't get any better. But maybe someone has some suggestions. 回答1: intersect calls ismember . In your case, you don't need all the complicated checks that intersect does, so you