LoggerFactory.getLogger(ClassName.class) vs LoggerFactory.getLogger(this.getClass().getName())

Late entry! As I am likely to be searching for this in the future. There is a way to create copy/paste friendly Logger instances (granted this is almost never a good reason to do something!) by using Java 7’s MethodHandles class. private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

scipy is not optimizing and returns “Desired error not necessarily achieved due to precision loss”

I copied your example and tried a little bit. Looks like if you stick with BFGS solver, after a few iteration the mu+ alpha * r will have some negative numbers, and that’s how you get the RuntimeWarning. The easiest fix I can think of is to switch to Nelder Mead solver. res = minimize(loglikelihood, … Read more

Is it possible to roll a significantly faster version of sqrt

Yes, it is possible even without trickery: sacrifice accuracy for speed: the sqrt algorithm is iterative, re-implement with fewer iterations. lookup tables: either just for the start point of the iteration, or combined with interpolation to get you all the way there. caching: are you always sqrting the same limited set of values? if so, … Read more

How to choose and optimize oracle indexes? [closed]

The Oracle documentation has an excellent set of considerations for indexing choices: http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/data_acc.htm#PFGRF004 Update for 19c: https://docs.oracle.com/en/database/oracle/oracle-database/19/tgdba/designing-and-developing-for-performance.html#GUID-99A7FD1B-CEFD-4E91-9486-2CBBFC2B7A1D Quoting: Consider indexing keys that are used frequently in WHERE clauses. Consider indexing keys that are used frequently to join tables in SQL statements. For more information on optimizing joins, see the section “Using Hash Clusters for Performance”. … Read more

How can I avoid std::vector to initialize all its elements?

The initialization of the elements allocated is controlled by the Allocator template argument, if you need it customized, customize it. But remember that this can get easily wind-up in the realm of dirty hacking, so use with caution. For instance, here is a pretty dirty solution. It will avoid the initialization, but it most probably … Read more

Disable compiler optimisation for a specific function or block of code (C#)

You can decorate a specific method (or a property getter/setter) with [MethodImpl(MethodImplOptions.NoOptimization)] and [MethodImpl(MethodImplOptions.NoInlining)], this will prevent the JITter from optimizing and inlining the method: [MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)] private void MethodWhichShouldNotBeOptimized() { } However, there isn’t a way to apply this attribute to a block of code. Also NoOptimization attribute was added in .NET 3.5, … Read more

At what point are WebSockets less efficient than Polling?

The whole point of a websocket connection is that you don’t ever have to ping the app for changes. Instead, the client just connects once and then the server can just directly send the client changes whenever they are available. The client never has to ask. The server just sends data when it’s available. For … Read more