optimization

How to improve performance method GetThumbnailAsync in window phone 8.1

放肆的年华 提交于 2019-12-30 11:47:05
问题 I write a function to show images on a folder (assume i have about 60 images in this folder) in window phone 8.1. And the problem is function GetThumbnailAsync() take so long time when i create stream to get bitmapImage. Here's my code //getFileInPicture is function get all file in picture folder List<StorageFile> lstPicture = await getFileInPicture(); foreach (var file in lstPicture) { var thumbnail = await file.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode.PicturesView,50);

Sql Server - Avoid deferred compilation

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-30 11:23:21
问题 I have an application that queries and updates two databases at the same time (different from each other) and it has already around 10 to 15 years of usage. So I would like to start clearing up the garbage from them. One of the things that I want to do is to remove all the stored procedures that are in database B that by mistake were created there (because they had to go in database A). If I do one by one, is easy because I can tell if the sp uses a table that is not in that database. But I

Massive CSV file into Matlab

北城余情 提交于 2019-12-30 11:21:06
问题 I have a CSV file 1.6 GB large, that I need to feed into matlab. I will have to do this frequently and I need it to run quickly. The file is of the form: 20111205 00:00.2 99.18 6 E 20111205 00:00.2 99.18 5 E 20111205 00:00.2 99.18 1 E 20111205 00:00.2 99.195 5 E 20111205 00:00.2 99.195 5 E 20111205 01:27.0 99.19 5 E 20111205 02:01.4 99.185 1 E 20111205 02:01.4 99.185 1 E 20111205 02:01.4 99.185 1 E 20111205 02:01.4 99.185 1 E The code I have right now is the following: tic; format long g fid

Massive CSV file into Matlab

怎甘沉沦 提交于 2019-12-30 11:20:47
问题 I have a CSV file 1.6 GB large, that I need to feed into matlab. I will have to do this frequently and I need it to run quickly. The file is of the form: 20111205 00:00.2 99.18 6 E 20111205 00:00.2 99.18 5 E 20111205 00:00.2 99.18 1 E 20111205 00:00.2 99.195 5 E 20111205 00:00.2 99.195 5 E 20111205 01:27.0 99.19 5 E 20111205 02:01.4 99.185 1 E 20111205 02:01.4 99.185 1 E 20111205 02:01.4 99.185 1 E 20111205 02:01.4 99.185 1 E The code I have right now is the following: tic; format long g fid

Concatenate range arrays given start, stop numbers in a vectorized way - NumPy

微笑、不失礼 提交于 2019-12-30 11:07:19
问题 I have two matrices of interest, the first is a "bag of words" matrix, with two columns: the document ID and the term ID. For example: bow[0:10] Out[1]: array([[ 0, 10], [ 0, 12], [ 0, 19], [ 0, 20], [ 1, 9], [ 1, 24], [ 2, 33], [ 2, 34], [ 2, 35], [ 3, 2]]) In addition, I have an "index" matrix, where every row in the matrix contains the index of the first and last row for a given document ID in the bag of words matrix. Ex: row 0 is the first and last index for doc id 0. For example: index[0

Concatenate range arrays given start, stop numbers in a vectorized way - NumPy

折月煮酒 提交于 2019-12-30 11:06:21
问题 I have two matrices of interest, the first is a "bag of words" matrix, with two columns: the document ID and the term ID. For example: bow[0:10] Out[1]: array([[ 0, 10], [ 0, 12], [ 0, 19], [ 0, 20], [ 1, 9], [ 1, 24], [ 2, 33], [ 2, 34], [ 2, 35], [ 3, 2]]) In addition, I have an "index" matrix, where every row in the matrix contains the index of the first and last row for a given document ID in the bag of words matrix. Ex: row 0 is the first and last index for doc id 0. For example: index[0

Boolean expressions optimizations in Java

孤街浪徒 提交于 2019-12-30 10:36:34
问题 Consider the following method in Java: public static boolean expensiveComputation() { for (int i = 0; i < Integer.MAX_VALUE; ++i); return false; } And the following main method: public static void main(String[] args) { boolean b = false; if (expensiveComputation() && b) { } } Logical conjunction (same as &&) is a commutative operation. So why the compiler doesn't optimize the if-statement code to the equivalent: if (b && expensiveComputation()) { } which has the benefits of using short

fixed point multiplication without 64 bit temporary

99封情书 提交于 2019-12-30 10:06:10
问题 Hi I'm implementing some fixed point math stuff for embedded systems and I'm trying to do the multiplication of two 16.16 fixed point numbers without creating a 64bit temporary. So far here is the code I came up with that generates the least instructions. int multiply(int x, int y){ int result; long long temp = x; temp *= y; temp >>= 16; result = temp; return result; } the problem with this code is that it uses a temporary 64 bit integer which seem to generate bad assembly code. I'm trying to

How to compress HTTP response headers?

左心房为你撑大大i 提交于 2019-12-30 09:56:29
问题 At the Velocity 2010 conference, Google said that header compression can yield big gains: Hölzle noted a glaring inefficiency in the handling of web page headers, which provide information about a user’s IP address, browser and other session data. The average web page makes 44 calls to different resources, with many of those requests including repetitive header data. Holzle said compressing the headers produces an 88 percent page load improvement for some leading sites. How does one ensure

llvm optimizes with library functions

女生的网名这么多〃 提交于 2019-12-30 09:51:53
问题 Starting with code like this void lib_memset( unsigned char *dest, unsigned char c, unsigned int n) { while(n--) { *dest=c; dest++; } } using llvm as a cross compiler clang -Wall -m32 -emit-llvm -fno-builtin --target=arm-none-eabi -c lib_memset.c -o lib_memset.bc opt -std-compile-opts -strip-debug -march=arm -mcpu=mpcore -mtriple=arm-none-eabi lib_memset.bc -o lib_memset.opt.bc llc -march=arm -mcpu=mpcore -disable-simplify-libcalls lib_memset.opt.bc -o lib_memset.opt.s llc -march=arm -mcpu