When should I use double instead of decimal?

I can name three advantages to using double (or float) instead of decimal: Uses less memory. Faster because floating point math operations are natively supported by processors. Can represent a...

Speeding up web development

Situation I have been working on a project lately where the UI development seems to be way too time consuming. In this case, the "Business Rules" on the server-side are much more complicated than...

Accessing math coprocessor from C#

How can I access math coprocessor from C# code? I would like to make some calculations on integers as fast as it's possible. I know it's possible under C++ compliers to use Assembler code inside...

RNGCryptoServiceProvider - generate number in a range faster and retain distribution?

I'm using the RNG crypto provider to generate numbers in a range the truly naive way: byte[] bytes = new byte[4]; int result = 0; while(result < min || result > max) { RNG.GetBytes(bytes); ...

Allowing resizing window pyGame

I am trying to allow resizing for this app, I put the RESIZABLE flag, but when I try to resize, it messes up! Try my code. It is a grid program, when the window resizes I want the grid to also...

Perfect filled triangle rendering algorithm?

Where can I get an algorithm to render filled triangles? Edit3: I cant use OpenGL for rendering it. I need the per-pixel algorithm for this. My goal is to render a regular polygon from triangles,...

Is it possible to make isnan() work in gfortran -O3 -ffast-math?

I would like to compile a program with gfortran and -O3 -ffast-math enabled, since it gives a nice performance boost. I was rather confused, that gfortran's isnan() catched some NaN's but not all...

Math library against own library in C#

So we tried developing a math class in C# and we did. Comparing results with the original math class for System.Math shows that we are always a little or a lot slower (trig methods...

What's the fastest way to square a number in JavaScript?

What's the fastest way to square a number in JavaScript? function squareIt(number) { return Math.pow(number,2); } function squareIt(number) { return number * number; } Or some other...

Dictionary or list in c#

I got a strange C# programming problem. There is a data retrieval in groups of random lengths of number groups. The numbers should be all unique,...

What is GCC/Clang equivalent of -fp-model fast=1 in ICC

As I read on Intel's website: Intel compiler uses /fp-model fast=1 as defaults. This optimization favors speed over standards compliance. You may use compiler option -mieee-fp to get compliant...

Sending HTTP Request at precise time intervals with JMeter

I'm using JMeter to test an Apache2 server I configured. I'd like to test whether the server can handle 200 HTTP requests coming altogether every second, repeatedly for a high number of seconds...

How to transform black into any given color using only CSS filters

My question is: given a target RGB color, what is the formula to recolor black (#000) into that color using only CSS filters? For an answer to be accepted, it would need to provide a function (in...

Will converting to PySDL2 make my app run faster than it does under PyGame?

I've written a little toy in Python using Pygame. It generates critters (a circle with a directional line, not an image) to wander around the screen. I'm interested in making it more...

Updating Gitlab from 9.3.7 to 9.3.8 getting Error installing re2

We are running on Ubuntu 14.04, with Gitlab 9.3.7, which works fine. We are trying to update to the latest security patch of Gitlab v9.3.8, but it gives us this error: Gem::Ext::BuildError: ERROR:...

Unexpected/inaccurate image color conversions in Go

It seems as if Go's conversion arithmetic from JPEG's YCbCr to RGBA is slightly off, based on Python's PIL and ImageMagick's color values, but I'm probably just overlooking something. PIL's and...

Emulate a very fast (virtual) CPU core

I know that the usual method when we want to make a big math computation faster is to use multiprocessing / parallel processing: we split the job in for example 4 parts, and we let 4 CPU cores run...

Why is webAssembly function almost 300 time slower than same JS function

Find length of line 300* slower First of I have read the answer to Why is my WebAssembly function slower than the JavaScript equivalent? But it has shed little light on the problem, and I have...

C# performance profiler shows long pause, unable to determine what it is from the data provided

I am getting an unexpected spike in my C# application when rendering frames. I have been going over it in a profiler and I noticed the following: When vsync is on, the program seems to relinquish...

Embedded GCC optimization magic

I have a project in which I try to build a Firmware for a micro controller and try to get better control of the optimization flags used. I would like, instead of using the -O<number> flag specify...

Install Ruby 2.2 on Mac OSX Catalina with ruby-install

Here's what I get when I try to install Ruby 2.2: $ ruby-install ruby 2.2.10 # ... >>> Compiling ruby 2.2.10 ... CC = clang LD = ld LDSHARED = clang -dynamic -bundle CFLAGS = -O3...

Poor C performance with both pthread and printf

I'm testing a c code for Linux with large arrays to measure thread performance, the application scales very well when threads are increased until max cores (8 for Intel 4770), but this is only for...

Why is math so slow in Erlang/the BEAM VM?

I was trying to understand why math might be so slow in Erlang, and if so, what I could do to find out where it is slow and try to speed it up. Some people said it's because it's a VM, but I doubt...

Faster way to sum all combinations of rows in dataframe

I have a dataframe of 10,000 rows that I am trying to sum all possible combinations of those rows. According to my math, that's about 50 million combinations. I'll give a small example to simplify...

Why are Java HTTP requests so slow (in comparison to Python), and how can I make them faster?

Java is a beautiful language, and is also supposedly very efficient. Coming from a background of having used Python, I wanted to see the difference between the 2 languages- and from the start I...

Numpy vs Eigen vs Xtensor Linear Algebra Benchmark Oddity

I recently was trying to compare different python and C++ matrix libraries against each other for their linear algebra performance in order to see which one(s) to use in an upcoming project. ...

Proof of impossibility (or counterexample) for tan(x) = infinity, for floating-point values

The POSIX page of the tan function family (tan, tanf, tanl) in C says that: If the correct value would cause overflow, a range error shall occur and tan(), tanf(), and tanl() shall return...

Can VUE CLI Run on be run/installed on Azure Pipelines?

I currently have our backend project running on azure pipelines and I would love to integrate our front-end VUE project in the same way. However, I have tried everything to get vue-cli-service...

Use of counter in C++ code for finding primes

I am working on producing C++ code to list all primes between 1 and 100 say. In order to present my question I need to provide some background. The basic idea of what I want to do is the...

How to get mask from a huge .tif file in rasterio python?

I have a large (~3GB) .tif file with Geo information embedded in it. I have a few Polygons (which are expressed by GPS coordinates) saved in a .shp file that describe specific areas in the image...