Latest Questions tagged Performance

Browse all latest questions tagged Performance

63
Votes
Published 01 May, 2022
Python - Does python logging flush every log?

When I write a log to file using the standard module logging, will each log be flushed to disk separately? For example, will the following code flush log by 10 times? logging.basicConfig(level=loggin...

99
Votes
Published 29 Jun, 2022
Python - Max in a sliding window in NumPy array

I want to create an array which holds all the max()es of a window moving through a given numpy array. I'm sorry if this sounds confusing. I'll give an example. Input: [ 6,4,8,7,1,4,3,5,7,2,4,6,2,1...

10
Votes
Published 24 Apr, 2022
Javascript - Why does Javascript `iterator.next()` return an object?

Help! I'm learning to love Javascript after programming in C# for quite a while but I'm stuck learning to love the iterable protocol! Why did Javascript adopt a protocol that requires creating a new...

18
Votes
Published 24 Apr, 2022
Python - Is it possible to speed-up python IO?

Consider this python program: import sys lc = 0 for line in open(sys.argv[1]): lc = lc + 1 print lc, sys.argv[1] Running it on my 6GB text file, it completes in ~ 2minutes. Question: is it p...

60
Votes
Published 27 Aug, 2022
Python - Using line_profiler with numba jitted functions

Is it possible to use line_profiler with Numba? Calling %lprun on a function decorated with @numba.jit returns an empty profile: Timer unit: 1e-06 s Total time: 0 s File: <ipython-input-29-486f0...

66
Votes
Published 23 Jun, 2022
Python - Why does my Python program average only 33% CPU per process? How can I make Python use all available CPU?

I use Python 2.5.4. My computer: CPU AMD Phenom X3 720BE, Mainboard 780G, 4GB RAM, Windows 7 32 bit. I use Python threading but can not make every python.exe process consume 100% CPU. Why are they u...

65
Votes
Published 22 Jun, 2022
Jquery - jQuery scrollTo/localScroll Speed Control?

I am making a vertically scrolling site, but localScroll is flying by way too fast. Is there a way to control it's speed?

17
Votes
Published 26 Aug, 2022
Python - Dask dataframe - split column into multiple rows based on delimiter

What is an efficient way of splitting a column into multiple rows using dask dataframe? For example, let's say I have a csv file which I read using dask to produce the following dask dataframe: id va...

124
Votes
Published 21 Jun, 2022
Python - What is the most efficient way of finding all the factors of a number in Python?

Can someone explain to me an efficient way of finding all the factors of a number in Python (2.7)? I can create an algorithm to do this, but I think it is poorly coded and takes too long to produce a...

198
Votes
Published 16 Apr, 2022
Javascript - How to change the playing speed of videos in HTML5?

According to this site, this is supported in the playbackRate and defaultPlaybackRate attributes, accessible via the DOM. Example: /* play video twice as fast */ document.querySelector('video').defau...

148
Votes
Published 16 Apr, 2022
Javascript - Controlling fps with requestAnimationFrame?

It seems like requestAnimationFrame is the de facto way to animate things now. It worked pretty well for me for the most part, but right now I'm trying to do some canvas animations and I was wondering...

29
Votes
Published 16 Apr, 2022
Javascript - Fastest MD5 Implementation in JavaScript

There are many MD5 JavaScript implementations out there. Does anybody know which one is the most advanced, most bugfixed and fastest? I need it for this tool.

74
Votes
Published 21 Aug, 2022
Python - SQLAlchemy "default" vs "server_default" performance

Is there a performance advantage (or disadvantage) when using default instead of server_default for mapping table column default values when using SQLAlchemy with PostgreSQL? My understanding is that...

20
Votes
Published 20 Aug, 2022
Python - Speeding up analysis on arrays in numpy

I have a python code, which imports 4 column txt file with numbers first three columns are x,y,z coordinate and fourth column is a density at that coordinate. below is the code that reads, converts t...

148
Votes
Published 20 Aug, 2022
Python - A better way for a Python 'for' loop

We all know that the common way of executing a statement a certain number of times in Python is to use a for loop. The general way of doing this is, # I am assuming iterated list is redundant. # Jus...