Latest Questions tagged Performance

Browse all latest questions tagged Performance

Published 01 May, 2022
Python - Python: count occurrences in a list using dict comprehension/generator

I want to write some tests to analyse the efficiency of different operations in python, namely a comparison of dictionary comprehensions and dict generators. To test this out, I thought I would try a...

Published 26 Aug, 2022
Python - Sort string with integers and words without any change in their positions

Say I have a string a. a = "12 I have car 8 200 a" I need to sort this string in such a way that the output should be 8 a car have 12 200 I ie, Sort the string in such a way that all words are i...

Published 26 Apr, 2022
Python - How do I profile a Python script?

Project Euler and other coding contests often have a maximum time to run or people boast of how fast their particular solution runs. With Python, sometimes the approaches are somewhat kludgey - i.e.,...

Published 22 Jun, 2022
Jquery - jQuery hasClass() - check for more than one class

With: if(element.hasClass("class")) I can check for one class, but is there an easy way to check whether "element" has any of many classes? I am using: if(element.hasClass("class") || element.has...

Published 01 May, 2022
Python - Python fastest access to nth line in huge file

I have an ASCII table in a file from which I want to read a particular set of lines (e.g. lines 4003 to 4005). The issue is that this file could be very very long (e.g. 100's of thousands to millions...

Published 19 Aug, 2022
Python - Why is this function slower in JAX vs numpy?

I have the following numpy function as seen below that I'm trying to optimize by using JAX but for whatever reason, it's slower. Could someone point out what I can do to improve the performance here?...

Published 23 Aug, 2022
Python - Why is this Fizz Buzz generator significantly faster than this Fizz Buzz Iterator class?

After learning about iterator class methods and generators, I tested the performance characteristics of simple Fizz Buzz solutions utilizing each idiom: >>> from timeit import timeit >&gt...

Published 21 Aug, 2022
Python - Efficiently counting number of unique elements - NumPy / Python

When running np.unique(), it first flattens the array, sorts the array, then finds the unique values. When I have arrays with shape (10, 3000, 3000), it takes about a second to find the uniques, but t...

Published 23 Apr, 2022
React - How styled-components affect performance?

Is using styled-components slows down the web app more than stylesheets do? If I care about the performance and don't have any styles that depend on props, should I just ditch styled-components and...

Published 02 Sep, 2022
Java - Tomcat process killed by Linux kernel after running out of swap space; don't get any JVM OutOfMemory error

I was performing load testing against a tomcat server. The server has 10G physical memory and 2G swap space. The heap size (xms and xmx) was set to 3G before, and the server just worked fine. Since I...

Published 29 Jun, 2022
Python - Speed up millions of regex replacements in Python 3

I have two lists: a list of about 750K "sentences" (long strings) a list of about 20K "words" that I would like to delete from my 750K sentences So, I have to loop through 750K s...

Published 05 Aug, 2022
Jquery - jQuery UI datepicker performance

I have a textbox on my web page that is used to specify a date, so I'd like to use the jQuery DatePicker. However, most of my users are locked into using IE6 and the performance of the jQuery DatePick...

Published 12 Sep, 2022
Java - Set the Tooltip Delay Time for a Particular Component in Java Swing

I'm trying to set tooltips on a JEditorPane. The method which I use to determine what tooltip text to show is fairly CPU intensive - and so I would like to only show it after the mouse has stopped for...

Published 20 Aug, 2022
Python - When numba is effective?

I know numba creates some overheads and in some situations (non-intensive computation) it become slower that pure python. But what I don't know is where to draw the line. Is it possible to use order o...

Published 06 May, 2022
Python - Which Python memory profiler is recommended?

I want to know the memory usage of my Python application and specifically want to know what code blocks/portions or objects are consuming most memory. Google search shows a commercial one is Python Me...