performance

Difference between ArrayList and LinkedList in Java - the whys for performance

这一生的挚爱 提交于 2021-02-07 03:09:35
问题 I thought I understood the difference between ArrayList and LinkedList theoretically pretty well. However, its the first time, I put it to a little test, and the tests came out, well different to my expectations. Expectations : Arraylist will be slower than LinkedList when inserting at the beginning, since it has to "shift" the elements, for linkedlist, its just updating 2 references. Reality : came out to be same on most iterations. For a select few iterations, it was slower. Arraylist will

Fast python GIS library that supports Great Circle Distance and polygon

佐手、 提交于 2021-02-06 23:33:04
问题 I was looking for a geographical library for python. I need to be able to do the following: Get the distance between 2 points (in meters) using Great-circle distance (not liner distance calculation) Check if a point is inside a polygon Perform 1 and 2 couple of thousands times per seconds At start I've looked at this post: Python module for storing and querying geographical coordinates and started to use geopy. I've encountered 2 problems: Geopy doesn't support polygons High CPU usage of

Fast python GIS library that supports Great Circle Distance and polygon

僤鯓⒐⒋嵵緔 提交于 2021-02-06 23:32:13
问题 I was looking for a geographical library for python. I need to be able to do the following: Get the distance between 2 points (in meters) using Great-circle distance (not liner distance calculation) Check if a point is inside a polygon Perform 1 and 2 couple of thousands times per seconds At start I've looked at this post: Python module for storing and querying geographical coordinates and started to use geopy. I've encountered 2 problems: Geopy doesn't support polygons High CPU usage of

Possible causes of cyclic FPS drops?

孤街浪徒 提交于 2021-02-06 20:07:52
问题 I was writing a new code base in opengl and have encountered a weird bug very early on. It is a distinct fluctuation in framerate that is repetitive and predictable. I know that it is definitely proportional to objects rendered. It is also proportional to screen size (not viewport size, not window size, just physical device size) It is roughly a ratio of 0.2:1 (low:high) frames I got curious and graphed it, bear in mind that the window/context isn't vsynced or capped. The view is completely

Possible causes of cyclic FPS drops?

流过昼夜 提交于 2021-02-06 19:57:50
问题 I was writing a new code base in opengl and have encountered a weird bug very early on. It is a distinct fluctuation in framerate that is repetitive and predictable. I know that it is definitely proportional to objects rendered. It is also proportional to screen size (not viewport size, not window size, just physical device size) It is roughly a ratio of 0.2:1 (low:high) frames I got curious and graphed it, bear in mind that the window/context isn't vsynced or capped. The view is completely

Why might std::vector be faster than a raw dynamically allocated array?

不羁的心 提交于 2021-02-06 13:54:57
问题 The result of a discussion with a colleague I ended up writing benchmarks to test std::vector vs raw dynamically allocated arrays, and ended up with a surprise. My tests are as follows: #include "testconsts.h" // defines NUM_INTS across all tests #include <vector> int main() { const int numInts = NUM_INTS; std::vector<int> intVector( numInts ); int * const intArray = new int[ numInts ]; ++intVector[0]; // force access to affect optimization ++intArray[0]; // force access to affect

Why might std::vector be faster than a raw dynamically allocated array?

狂风中的少年 提交于 2021-02-06 13:52:35
问题 The result of a discussion with a colleague I ended up writing benchmarks to test std::vector vs raw dynamically allocated arrays, and ended up with a surprise. My tests are as follows: #include "testconsts.h" // defines NUM_INTS across all tests #include <vector> int main() { const int numInts = NUM_INTS; std::vector<int> intVector( numInts ); int * const intArray = new int[ numInts ]; ++intVector[0]; // force access to affect optimization ++intArray[0]; // force access to affect

Why is cross_val_predict so much slower than fit for KNeighborsClassifier?

我们两清 提交于 2021-02-06 12:55:23
问题 Running locally on a Jupyter notebook and using the MNIST dataset (28k entries, 28x28 pixels per image, the following takes 27 seconds . from sklearn.neighbors import KNeighborsClassifier knn_clf = KNeighborsClassifier(n_jobs=1) knn_clf.fit(pixels, labels) However, the following takes 1722 seconds , in other words ~64 times longer : from sklearn.model_selection import cross_val_predict y_train_pred = cross_val_predict(knn_clf, pixels, labels, cv = 3, n_jobs=1) My naive understanding is that

Why do inline scripts block rendering when put at the bottom of a page?

混江龙づ霸主 提交于 2021-02-06 12:48:46
问题 I read High Performance Web Sites: Essential Knowledge for Front-End Engineers and in it the author suggests that all JavaScript code should be externalized and put at the bottom of the page instead of putting it in the head. This is illustrated in this example. The external script tag blocks both downloading and progressive rendering of a page, so the solution was to put it at the bottom of the page. However, in his second book Even Faster Web Sites: Performance Best Practices for Web

Why do inline scripts block rendering when put at the bottom of a page?

筅森魡賤 提交于 2021-02-06 12:48:12
问题 I read High Performance Web Sites: Essential Knowledge for Front-End Engineers and in it the author suggests that all JavaScript code should be externalized and put at the bottom of the page instead of putting it in the head. This is illustrated in this example. The external script tag blocks both downloading and progressive rendering of a page, so the solution was to put it at the bottom of the page. However, in his second book Even Faster Web Sites: Performance Best Practices for Web