memory-efficient

efficient way of constructing a matrix of pair-wise distances between many vectors?

限于喜欢 提交于 2021-02-11 08:10:37
问题 First, thanks for reading and taking the time to respond. Second, the question: I have a PxN matrix X where P is in the order of 10^6 and N is in the order of 10^3. So, X is relatively large and is not sparse. Let's say each row of X is an N-dimensional sample. I want to construct a PxP matrix of pairwise distances between these P samples. Let's also say I am interested in Hellinger distances. So far I am relying on sparse dok matrices: def hellinger_distance(X): P = X.shape[0] H1 = sp.sparse

Instantiating C++ objects from QML has tremendous memory usage overhead

此生再无相见时 提交于 2021-02-07 07:59:37
问题 Instantiating a QObject derived class on the heap in C++ gives me roughly about 160 bytes per object. Registering the same object via qmlRegisterType() for creation from QML and creating the object dynamically via createObject() gives me a little over 2000 bytes per object. That's quite the difference, almost 13 times more memory per object is being used when creating from QML. Note that the object doesn't have any bindings or anything extra compared to how it is in C++. Naturally, being

Instantiating C++ objects from QML has tremendous memory usage overhead

谁说我不能喝 提交于 2021-02-07 07:58:25
问题 Instantiating a QObject derived class on the heap in C++ gives me roughly about 160 bytes per object. Registering the same object via qmlRegisterType() for creation from QML and creating the object dynamically via createObject() gives me a little over 2000 bytes per object. That's quite the difference, almost 13 times more memory per object is being used when creating from QML. Note that the object doesn't have any bindings or anything extra compared to how it is in C++. Naturally, being

Q_GADGET vs an accessor object for manipulating a polymorphic tree of C++ objects from QML

喜欢而已 提交于 2020-01-17 06:14:09
问题 I have a polymorphic tree of C++ types that I need to work with from QML. Memory usage and performance are key here, so I wonder which approach would be more efficient: Q_GADGET - without a doubt the easier and faster way to do it. I can directly use properties (without notifications so no bindings either) and slots to access each object's members. It relies on meta data generation and some kind of object identification in the qtquick runtime. Use an global accessor object for accessing

Q_GADGET vs an accessor object for manipulating a polymorphic tree of C++ objects from QML

回眸只為那壹抹淺笑 提交于 2020-01-17 06:14:09
问题 I have a polymorphic tree of C++ types that I need to work with from QML. Memory usage and performance are key here, so I wonder which approach would be more efficient: Q_GADGET - without a doubt the easier and faster way to do it. I can directly use properties (without notifications so no bindings either) and slots to access each object's members. It relies on meta data generation and some kind of object identification in the qtquick runtime. Use an global accessor object for accessing

Make LEFT JOIN query more efficient

。_饼干妹妹 提交于 2020-01-16 18:12:48
问题 The following query with LEFT JOIN is drawing too much memory (~4GB), but the host only allows about 120MB for this process. SELECT grades.grade, grades.evaluation_id, evaluations.evaluation_name, evaluations.value, evaluations.maximum FROM grades LEFT JOIN evaluations ON grades.evaluation_id = evaluations.evaluation_id WHERE grades.registrar_id = ? Create table syntax for grades: CREATE TABLE `grades` ( `grade_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `evaluation_id` int(10) unsigned

Pthreads - High memory usage

杀马特。学长 韩版系。学妹 提交于 2020-01-12 07:44:09
问题 I am programming something in C that creates a lot of Pthreads in Linux on a 256Mb system. I usually have +200Mb free. When I run the program with a low amount of threads it works, but once I make it create around 100 threads it gives errors because the system runs out of memory. I did several tests and each threads use almost 2Mb. The stack size of the threads is set to 16Kb. The code I use to create each thread: pthread_attr_t attr; pthread_attr_init(&attr); size_t stacksize; stacksize =

java efficiency comparison in terms of memory allocation

↘锁芯ラ 提交于 2020-01-11 10:49:11
问题 This may be a duplicate question but I couldnt find what I am searching. If it exists, sorry about duplication. I want to learn that if the following part of codes are same in terms of memory allocation. //first int n = some_number; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ int a = something; } } //second int i, j, a; for(i = 0; i < n; i++){ for(j = 0; j < n; j++){ a = something; } } I wonder, if java allocates the variable a n^2 times and j n times in the first code or both are

java efficiency comparison in terms of memory allocation

我只是一个虾纸丫 提交于 2020-01-11 10:49:06
问题 This may be a duplicate question but I couldnt find what I am searching. If it exists, sorry about duplication. I want to learn that if the following part of codes are same in terms of memory allocation. //first int n = some_number; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ int a = something; } } //second int i, j, a; for(i = 0; i < n; i++){ for(j = 0; j < n; j++){ a = something; } } I wonder, if java allocates the variable a n^2 times and j n times in the first code or both are

efficient xslt conditional increment

夙愿已清 提交于 2020-01-06 02:16:07
问题 In this question i asked how to perform a conditional increment. The provided answer worked, but does not scale well on huge data-sets. The Input: <Users> <User> <id>1</id> <username>jack</username> </User> <User> <id>2</id> <username>bob</username> </User> <User> <id>3</id> <username>bob</username> </User> <User> <id>4</id> <username>jack</username> </User> </Users> The desired output (in optimal time-complexity): <Users> <User> <id>1</id> <username>jack01</username> </User> <User> <id>2</id