Skip to main content

All Questions

Tagged with
7 votes
2 answers
116 views

Do Python coders have a bias towards list over tuple? [closed]

Basic Facts Lists are mutable (supporting inserts, appending etc.), Tuples are not Tuples are more memory efficient, and faster to iterate over So it would seem their use-cases are clear. ...
Della's user avatar
  • 1,550
0 votes
1 answer
89 views

How to make this Python function even faster, lists processing

I was doing a Hackerrank question (I already finished that test, I am just asking because I am curious). Most of test cases were successful but a few said that it took too long, so I had to optimize ...
Andres Masis's user avatar
0 votes
0 answers
46 views

Why Python multithreading is not speeding things up? [duplicate]

#from concurrent.futures import ProcessPoolExecutor from concurrent.futures import ThreadPoolExecutor import time values = range(1,9999) def dissect1(qq): adding = sum(list1[qq:qq+100000]) ...
Matthias Ho's user avatar
2 votes
2 answers
113 views

element-wise add / subtract / multiply / divide operation in two lists in C#

Considering element-wise add / subtract / multiply / divide operation in two lists. I have the code as follows. public class Calculate { public static IEnumerable<T> Add<T>(IEnumerable&...
JimmyHu's user avatar
  • 489
0 votes
1 answer
89 views

performance of getting a new list with an additional value

To get a new list from a list with an additional value, I used to think that list_b = [*list_a, value] is more performant than list_b = list_a + [value], as the latter generates an intermediate [value]...
Danny Lin's user avatar
  • 2,270
6 votes
3 answers
238 views

How to find the path of an element in a nested list

How can I find the path of an element in a nested list without manually digging through a list in a View? Here is an example that I can already deal with: l1 <- list(x = list(a = "no_match&...
JBGruber's user avatar
  • 12.3k
1 vote
1 answer
119 views

Efficient list sorting: Using heap instead of standard sorting is slower

I'm trying to create a more efficient way to sort lists and dictionaries in python and came across Efficient data structure keeping objects sorted on multiple keys. There the suggested solution was to ...
Lion In A Box's user avatar
-1 votes
2 answers
54 views

Compare List of objects in java script

I want to create a function to compare a list of objects in the fast way for (let i = 0; i < posts.length - 1; i++) { for (let j = i + 1; j < posts.length; j++) { const post1 = posts[i]; ...
Guilherme Queiroz Ribeiro's user avatar
4 votes
4 answers
253 views

Which is more efficient in python (and in general): iterate over short list and searching in the longer one, or vice versa?

I have two lists, both contain integers represented as strings. large_list is large, up to low 10s of thousands of elements. small_list is smaller, up to hundreds of elements. I am filtering the ...
skytwosea's user avatar
  • 318
2 votes
0 answers
117 views

How do I find my memory leaky lists in flutter?

I used the Flutter Dev Tool Memory view to look for some issues in my performance. To me it looks like I am having some issues with my lists. The total size and the instances keep rising when doing ...
Valentin Rupp's user avatar
2 votes
3 answers
125 views

Most efficient way to check if sublist is present in list, ignoring the last element

I have a list that's structured like this: [ [1, 2, 'A'], [3, 4, 'B'], [5, 6, 'C'], ... ] I want to check if there exists a list inside this list, such that the first two elements are ...
M1n3c4rt's user avatar
1 vote
1 answer
65 views

Looking for help to decrease runtime of my code in Python

The overall goal of the code is the following: The main list has x,y,z coordinates. I want to group rows together in which each x,y, and z coordinate is not more than +/-5 from eachother ("margin&...
compto2017's user avatar
2 votes
2 answers
2k views

How to optimize the rendering of a large list of items in React?

I have a React component that renders a large list of items (about 1000) using the map method. Each item is a complex component that has its own state and props, and can be updated by the user. The ...
Saeed Mansoori's user avatar
0 votes
1 answer
110 views

Summing the boolean attributes of a list of objects in Python

I have a list of python objects which have a boolean attribute. I wish to sum these booleans (i.e. count how many are true) in a relatively performant way. My test script looks something like: import ...
condimentman's user avatar
0 votes
2 answers
99 views

Performance Issue with List<byte>

I have a file (~30MB) which I read with File.ReadAllBytes() This File has a lot of structed data with different length (no terminator in between). So I have to check the length of the first data, cut ...
Toby_Stoe's user avatar
  • 326

15 30 50 per page
1
2 3 4 5
71