417 questions
1
vote
0
answers
48
views
Pine script variable definition with var vs without var ,performance?
In Pine script version 6, we can define a variable with var and without var.
Like this sample:
var float Number1 = 0.0
and
float Number1 = 0.0
If this variable does not need the value of the ...
0
votes
2
answers
455
views
is there a quicker way to save csv files as polars dataframes than using list comprehension?
I have 2 folders each containing 1507 csv files, i am using the following code to save each file as a polars dataframe using list comprehension:
bdsim=[pl.read_csv(x, schema_overrides = {"X0.6&...
1
vote
0
answers
48
views
Optimizing Batch Inserts for Improved Efficiency in Flask SQLAlchemy
I am trying to insert 60 to 70 rows at once in a SQL Server table. Currently, I have a function to do it but it is taking almost 15 seconds to complete the task. It would not be a problem if it was ...
0
votes
0
answers
29
views
SQL - Is there a shorthand to refer to columns with same prefix and incrementing suffix (like, var1, var2, var3...) in a where statement?
I'm looking to do something like this:
create or replace table patients as
select distinct id
from dataset
where value in (var1:var30)
;
I could make a temp table that contains just the variable ...
1
vote
1
answer
256
views
Fastest way to do repeated element wise matrix multiplication in MATLAB?
Given a matrix A, I need to multiply with another constant vector B, N times (N > 1 million). The size of A is 9000x1 and B is 9000x1000.
The code is currently evaluated in the following way:
for i=...
0
votes
1
answer
60
views
Is it efficient to access/update an array using stored in site options using get_option and update_option in a loop?
I have an array stored in the site options in WordPress which will potentially have 3000 email addresses in it. Every night I need to process this list with some checks on those email addresses and I'...
0
votes
1
answer
42
views
Pandas Dataframe with dictionary cells | accumulate by values | inefficient apply method
Given:
Sample Pandas Dataframe with dictionaries in each cell:
user_token_df = pd.DataFrame(
{
"usr": ["u1", "u2", "u3", "u4", "u7"...
-1
votes
2
answers
96
views
How to combine comparisons of the same variable in if statements
if (i != 0 && i != 15 && i != 20)
{
...
}
For the above code snippet, how can I combine all the conditions so I won't have to use multiple comparison operators?
0
votes
0
answers
41
views
Inefficient programming with jdbc and mysql
I am currently programming an application, that connnects to a mysql database and reads, inserts and changes data in it. I am coding in Kotlin and use the JDBC Driver. My problem is, that for every ...
0
votes
1
answer
893
views
What is the most efficient way to remove tracking, marketing, etc query parameters from a URL in .NET? [closed]
So, I have an issue. I need to try and get as "clean" or a URL as possible; meaning removing unnecessary query parameters from an URL. I realize that this would be close to impossible to do, ...
-1
votes
1
answer
110
views
What is the cost function for this algorithm?
my question is in the title.
After hours of thinking and looking up sites on google i came to the conclusion that i'm not quite sure how to solve this problem or if it is correct. Maybe you guys could ...
0
votes
2
answers
43
views
How to code it in a more efficient way : delete multiple row with a very complex condition in R
Below is a sample of a large data set from which I want to delete quadrats (Qm) numbered greater than than 3 in parcels (PARCELLE) 1, 3, 4, and 8.
FIELD SECTOR PARCELLE Qm Total
North A 1 ...
0
votes
2
answers
347
views
Use variable in 'document.getElementById("…")' for IDs to reduce duplicated code
I have written a dice roller utility for a tabletop RPG in JavaScript.
Before I add more functionality to it, I would like to simplify the code by simplifying functions to remove unnecessary code.
...
0
votes
1
answer
1k
views
Is it possible to show a different icon on taskbar for a Windows application instance ran with a different user account?
I run 2 Microsoft Edge browser instances for work, 1 for normal use and the other for AWS Console SAML login. I often mix them up.
The latter is started with "runas /u: 'C:\ \msedge.exe'".
...
0
votes
1
answer
35
views
R: Improving processing time for a set of codes
Question:
How can I improve the processing time of the following code?
Goal description:
I have the following example dataset in which each observation contains
ids of two individuals (the primary ...
0
votes
2
answers
238
views
Delete rows with overlapping intervals efficiently
Consider the following DataFrame
>>> df
Start End Tiebreak
0 1 6 0.376600
1 5 7 0.050042
2 15 20 0.628266
3 10 15 0.984022
4 11 12 0.909033
5 ...
0
votes
0
answers
104
views
Difference between pandas functions: df.assign() vs df.reset_index()
So lets say I have a DataFrame:
stuff temp
id
1 3 20.0
1 6 20.1
1 7 21.4
2 1 30.2
2 3 0.0
2 2 34.0
3 7 0.0
3 6 0.0
3 ...
0
votes
0
answers
29
views
Should I create core classes for better quality Flutter code?
I'm trying to improve myself to write better quality code. However, I have a question. For example, does it make sense to create an appbar class like the one below and call that code where I need it? ...
1
vote
1
answer
369
views
Which is faster ?Multiple Conditions in one IF statement or switch case with multiple IF statements
I came to a point where I needed to check a condition and proceed with another condition if its true for many times.
Here I'm using fromNS string which has the base of number (like - binary, decimal, ...
1
vote
4
answers
156
views
Is there way to optimize the speed for changing values in a >2 million row data frame?
I have got a tibble of more than 2 million rows. One of the columns size is a value using M to represent million, k to represent thousand; it also has some <NA> values. The column type is ...
0
votes
0
answers
139
views
The fastest and most efficient way to get repeated numbers in a nested array [duplicate]
I know how to do this combining a lot of if...else statements but I need a faster and more efficient way.
I need a function that will run through a nested array and return the numbers that occur more ...
1
vote
0
answers
61
views
efficiency in 2 different scenario of code structure on mql4 Expert Advisor
Hi I have EA with code structure like this,
void OnTick()
{
resetCounterVar(); //there's for loop
CloseOrders(); //there's for loop
UpdateAllOpenOrders(); //there's for loop
SetSLTP(); //...
0
votes
2
answers
85
views
Efficiency question: how to compare two huge nested lists and make changes based on criteria
I want to compare two huge identical nested lists and by iterating over both of them. I'm looking for nested lists in where list_a[0] is equal to list_b[1]. In that case I want to merge those lists (...
0
votes
0
answers
91
views
Find timedeltas in dataframe
I have a pandas dataframe containing 400 individual measurements. Each mesurment is a time series composed of roughly 1000 rows. The whole dataframe therefore contains roughly 400.000 rows. The index ...
-1
votes
1
answer
54
views
How can I make one piece of code for several structs?
I have 4 structs:
Computer,
Home,
Car,
Ship
I declared:
1. An array that can hold up to 5 types of computers.
2. An array that can hold up to 20 houses, each can have one computer.
3. An array that ...