Decimal.MinValue costs more than you expect

Recently during profiling session one method caught my eye, which in profiler's decompiled version looked like this: public static double dec2f(Decimal value) { if (value == new Decimal(-1, -1, -1, true, (byte) 0)) return double.MinValue...
more »

2017-04-17 10:04 (1) Answers

Can I speed up this function?

I'm trying to write John Conway's Game of Life in C, but I'm having trouble adding living cells to the board. The function I wrote to handle it is extremely slow. Thought process: I want to add n living cells to the board randomly, so while cells le...
more »

2017-04-15 06:04 (4) Answers

Unable to dump a folder from 100Gb SVN repo

I need to extract a folder from my SVN repository and preserve its history. So I decided to use svnadmin dump command. My SVN repo is huge - 100 Gb and 120k of revisions. Im using this command: svnadmin dump D:\Repositories\SvnRepository -r 107968 |...
more »

2017-04-14 22:04 (1) Answers

Vectorizing min and max of slices possible?

Suppose that I have a NumPy array of integers. arr = np.random.randint(0, 1000, 1000) And I have two arrays lower and upper, which represent lower and upper bounds respectively on slices of arr. These intervals are overlapping and variable-length...
more »

2017-04-11 02:04 (3) Answers

Code optimization python

I wrote the below function to estimate the orientation from a 3 axes accelerometer signal (X,Y,Z) X.shape Out[4]: (180000L,) Y.shape Out[4]: (180000L,) Z.shape Out[4]: (180000L,) def estimate_orientation(self,X,Y,Z): sigIn=np.array([X,Y,Z]).T ...
more »

2017-04-08 15:04 (1) Answers

Lazy initialization of Fabric kits?

Is it possible to lazily initialize Fabric Kits? for example, right now I do: Fabric.with(this, crashlytics, twitterCore, tweetUi); // 500ms I would like to initialize only Crashlytics (no twitter stuff), like below, because it is 10x faster, and ...
more »

2017-04-07 19:04 (2) Answers

Why is C array so much faster than std::array?

We are currently writing some performance critical code in C++ that operates on many large matrices and vectors. Regarding to our research, there should be no major performance difference between std::array and standard C arrays (See This question o...
more »

2017-04-03 13:04 (2) Answers

GTMetrix Wordpress Speed issue

I am trying to reduce the load time for my website using GTMetrix. I find below references from my site. But I am not able to find the source. I checked themes and plugins as well and came to conclusion its some unwanted code or spam. https://cdn.a...
more »

2017-04-01 18:04 (1) Answers

Verify that the key of a data.table is unique

What is the fastest way to verify that the key of a data.table is unique? Is there a faster or more idiomatic way than has_unique_key <- function(.data){ uniqueN(.data, by = key(.data)) == nrow(.data) } To avoid overhead performance costs, t...
more »

2017-04-01 09:04 (0) Answers

where is device to host memory copy in MATLAB

I am new in MATLAB gpu computing. In the following code, I used some gpu arrays which are created in the device directly. However, NVidia Visual Profiler shows that there are a large amount of Device to Host (D2H) memory copy. Would you please learn...
more »

2017-03-29 23:03 (0) Answers

Intel Core i7 processor and cache behaviour

I have run the following assembly code: (that iterates 1000 times through an array of 10 000 000 elements each of 4 bytes) on an Intel Core i7 CPU (with 32KB L1 data cache and 64B L1 cache line size) main: .LFB0: .cfi_startproc mov edx, 1000...
more »

2017-03-28 17:03 (1) Answers

Dash path effect making screen sluggish

I am trying to make a custom view with concentric circles made up of dots. I have attached a screenshot for reference. Till the time custom view just have concentric circles it works fine but as soon as I apply DashPathEffect it makes the whole scree...
more »

2017-03-22 07:03 (2) Answers