optimization

HLSL branch avoidance

倾然丶 夕夏残阳落幕 提交于 2020-01-01 09:39:09
问题 I have a shader where I want to move half of the vertices in the vertex shader. I'm trying to decide the best way to do this from a performance standpoint, because we're dealing with well over 100,000 verts, so speed is critical. I've looked at 3 different methods: (pseudo-code, but enough to give you the idea. The <complex formula> I can't give out, but I can say that it involves a sin() function, as well as a function call (just returns a number, but still a function call), as well as a

SPOJ 370 - Ones and zeros (ONEZERO)

╄→гoц情女王★ 提交于 2020-01-01 09:29:27
问题 I am trying to solve SPOJ problem "Ones and zeros": Certain positive integers have their decimal representation consisting only of ones and zeros, and having at least one digit one, e.g. 101. If a positive integer does not have such a property, one can try to multiply it by some positive integer to find out whether the product has this property. My approach to this problem was simply doing BFS. Taking string containing only '1' and then doing BFS with it and at each step adding '1' and '0' .

How do I extract a bit in a more optimal way?

假装没事ソ 提交于 2020-01-01 08:58:04
问题 I had a interview today where they asked me to write two "C" functions, one to to extract a single bit and other to extract a range of bits from a character. I took a while and came up with these methods. int extractBit(char byte, int pos) { assert( (pos >= 0) && (pos < 8) ); return ( ( byte & (1<<pos) ) >> pos); } char extractBitRange(char byte, int startingPos, int offset) { assert( ( (startingPos + offset) >= 0) && ( (startingPos + offset) < 8) ); return ( byte >> startingPos ) & ~(0xff <<

Discrete optimzation in python

守給你的承諾、 提交于 2020-01-01 08:53:33
问题 I am trying to use the scipy.optimize package to optimize a discrete optimization problem (global optimization). Acc to the doc, simulated annealing implemented in scipy.optimize.anneal should be a good choice for the same. But I am not sure how to force the optimizer to search only integer values of the search space. Can someone help? An illustrative example: f(x1,x2) = (1-0.4*x1)^2 + 100*(0.6*x2 -0.4*x1^2)^2 where, $x1, x2 \in I$ 回答1: I've checked scipy.optimize.anneal, and I can't see a

Is accessing c++ member class through “this->member” faster/slower than implicit call to “member”

坚强是说给别人听的谎言 提交于 2020-01-01 08:37:12
问题 After some searching on our friend google, I could not get a clear view on the following point. I'm used to call class members with this-> . Even if not needed, I find it more explicit as it helps when maintaining some heavy piece of algorithm with loads of vars. As I'm working on a supposed-to-be-optimised algorithm, I was wondering whether using this-> would alter runtime performance or not. Does it ? 回答1: No, the call is exactly the same in both cases. 回答2: It doesn't make any difference.

optimization - stepping may behave oddly : iOS/Unity

廉价感情. 提交于 2020-01-01 08:18:46
问题 I am trying to integrate unity to iOS application. I have followed this tutorial http://www.agnosticdev.com/blog-entry/swift/integrating-unity-and-vuforia-ios-swift-project Now after integrating when i start my app it crashes and show this error on console : was compiled with optimization - stepping may behave oddly; variables may not be available. Crash : I have tried googling this and found these links : APPNAME was compiled with optimization - stepping may behave oddly; variables may not

Visual Studio error D8016: '/ZI' and '/O2' command-line options are incompatible

柔情痞子 提交于 2020-01-01 07:45:08
问题 Visual Studio error D8016: '/ZI' and '/O2' command-line options are incompatible I'm using optimization for the first time with C++. When I 'build solution' I keep getting this error. In the property pages, I have configuration set to Release Under project/properties/c++/optimization I tried all the options except for disable. Under project/properties/c++/General I also tried all the options under 'Debug Information Format' (assume 'None' is a good choice?). I think it might have something to

std::vector-like class optimized to hold a small number of items [duplicate]

别说谁变了你拦得住时间么 提交于 2020-01-01 07:35:34
问题 This question already has answers here : small string optimization for vector? (4 answers) Closed 4 years ago . In one time-critical part of the program there is a member of the class that looks like that: std::vector m_vLinks; During profiling I noticed that about 99.98% of executions this vector holds only 0 or 1 items. However in very rarely cases it might hold more. This vector is definitely a bottleneck according to profiler, so I'm thinking about following optimization: Craft a hand

SQL tuning in Oracle [closed]

旧街凉风 提交于 2020-01-01 06:42:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Is there any article/link available where I can find examples of SQL tuning(Oracle). It would great if it is explain with example. I need something like existing query, statstics, plan and then suggested query/recommendation and new plan. I found couple of really good links on google: http://www.dba-oracle.com

Finding the optimal 3D box sizes for a group of 3D rectangular items

梦想与她 提交于 2020-01-01 05:48:26
问题 When I say box I am talking about shipping boxes. I have a number of random sized, small items that I need to pack into as few boxes as possible. I need to know what box sizes are optimal. All items are rectangular prisms. It's easy to exclude a box size for an item which is too large to fit. I know the box sizes (they are the available box sizes which I have in-stock) Items can be positioned horizontally or vertically, not diagonal. As many boxes as required can be used. The goal is to use