optimization Questions

1

I'm trying to optimize an algorithm that counts permutations with specific constraints. Given integers n, t, a, b where: n is the length of permutation (1 to n) t is the required number of fixed p...

2

Can I rely on Snowflake's lazy evaluation for testing and exception throwing? Are CTEs lazily evaluated? Is this documented? (related question: Assertions in Snowflake)

3

I am trying to implement two classes A and B which contain data stored in std::unique_ptr container, and A could transform to B with some calculation. The class A and class B are shown as below. Th...
Origan asked 25/2, 2020 at 2:6

8

Solved

Is there any way (possibly a dirty hack) to create an ImmutableArray which will just use a specified array, instead of copying it over? I have an array which I know won't change, and I want to crea...
Slocum asked 12/7, 2018 at 7:49

3

When I add a UILabel with text to a UIView and then scale the UIView, the contents is displayed with pixelation. The greater the scale factor, the greater the pixelation. I understand using a CATe...
Pasticcio asked 10/10, 2017 at 2:26

13

Solved

I would like to know how else I can optimize bubble sort so that it overlooks elements that have already been sorted, even after the first pass. Eg. [4, 2, 3, 1, 5, 6] --> [2, 3, 1, **4, 5, 6**]...
Sabadell asked 24/4, 2013 at 14:48

2

Here is a bounded loop that increments two locations of the same buffer. unsigned int getid(); void foo(unsigned int *counter, unsigned int n) { unsigned int A = getid(); unsigned int B = getid()...
Marleah asked 7/12, 2023 at 7:37

4

Solved

Unfortunately, the standard C++ library doesn't have a single call for sincos, which gives a place for this question. First question: If I want to calculate a sin and a cos, is it cheaper to calc...
Universe asked 13/9, 2013 at 19:38

3

Solved

I came up with the following implementation for the Greedy Set Cover after much discussion regarding my original question here. From the help I received, I encoded the problem into a "Greedy Set Co...
Mesocarp asked 29/10, 2011 at 23:22

4

Solved

Suppose I have a matrix that is 100000 x 100 import numpy as np mat = np.random.randint(2, size=(100000,100)) I wish to go through this matrix, and if each row contains entirely either 1 or 0 I...
Buroker asked 25/6, 2019 at 15:49

4

Key Points: I have a default ball trajectory generated using some code(provided below). Lets name this trajectory Initial Trajectory. Next I have an actual ball whose trajectory I need to estimate...

4

Solved

I have an upper-triangular matrix of np.float64 values, like this: array([[ 1., 2., 3., 4.], [ 0., 5., 6., 7.], [ 0., 0., 8., 9.], [ 0., 0., 0., 10.]]) I would like to convert this into the c...
Marino asked 5/11, 2019 at 19:42

7

i'm trying to optimize this website: electronicsportsitalia-it and when I try to analyze it on Google PageSpeed the platform says that there is a google font blocking the page rendering: https://f...
Astral asked 31/8, 2017 at 13:58

3

Solved

I'm working on a small Python program for myself and I need an algorithm for fast multiplication of a huge array with prime powers (over 660 000 numbers, each is 7 digits). The result number is ove...
Constringe asked 15/7 at 23:55

3

Solved

I just reduced this SVG: <?xml version="1.0" standalone="no"?> <svg viewBox="0 0 480 150" style="background-color:#ffffff00" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink=...
Botanize asked 25/5, 2015 at 20:21

2

Solved

I have been trying to understand how to write the cache-friendly code. So as a first step, i was trying to understand the performance difference between array row-major access and column major acce...
Driedup asked 30/12, 2013 at 7:38

1

Solved

Let's say you have an enum: enum Expr { binExp, unExp, Literal, Group, } Should you prefer match or if/else chains to call methods based on Expr? match self { Expr::binExp => todo!(), ...
Madalynmadam asked 9/4, 2022 at 9:37

4

Solved

At some point in my program I compute an integer divisor d. From that point onward d is going to be constant. Later in the code I will divide by that d several times - performing an integer divisi...
Blaise asked 27/7, 2017 at 14:23

2

I want to fit non-negative parameters (xs in the code) to a function fp, given by where v and L are fixed, given parameters. Computing fp can be done relatively quickly by vectorizing it and using...

0

Please note that this question is not about YUV422 to RGB conversion! I have this code for a pixel order YUV422 to RGB conversion. static void yuv422ToRGB(unsigned char* img, int width, int height...
Cocotte asked 20/6 at 15:3

3

Solved

The application I'm working on is very focused on performance, and as such needs to keep allocations down to a minimum to keep GC stalls down. I was surprised to find that System.Guid does not exp...
Rogovy asked 22/10, 2015 at 23:3

2

Solved

My one test file with 7 empty tests is taking 5+ seconds to start running. I've used both flutter test and the Dart test runner in VS Code, and they both take about the same amount of time. My whol...

7

Solved

I'm looking for the best way to get the first and the last day of a last month. I use them for make SQL queries to get stats of last month. I think that this is the best way, more optimized ...
Unsay asked 16/3, 2012 at 10:29

3

I have a large SPA with a single large CSS file which contains many rules. Some of them are outdated and should be refactored or removed. It is compiled from a set of SCSS source files. I am now r...
Autohypnosis asked 23/3, 2017 at 8:23

2

Solved

I'd like to define a boolean function (with n inputs and m outputs) in a tabular form. I'd like to find an optimal boolean expression which implements the function. Optimal here means that, impleme...
Wickham asked 7/5, 2011 at 16:10

© 2022 - 2024 — McMap. All rights reserved.