Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Varying performance based on python version #9870

Open
6 of 9 tasks
mokrueger opened this issue May 6, 2024 · 1 comment
Open
6 of 9 tasks

Varying performance based on python version #9870

mokrueger opened this issue May 6, 2024 · 1 comment
Labels
question Question

Comments

@mokrueger
Copy link

mokrueger commented May 6, 2024

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I intentionally remove or skip any mandatory* field

Checklist

Please make sure the question is worded well enough to be understood

Around a year ago I set up a server to download YouTube videos. The response times used to be quite fast when querying formats for a given video. Since for some Websites updates were required I updated ytdlp from time to time.

The current versions appear to be slower. Is there any particular reason? Or are there ways to run it more performant.
Also the performance varies drastically based on the python version? Any clues on why that could be?

Also back when everything ran on python 3.7 I remembered things to be a lot faster...

Given the simple benchmark script:

import time
from yt_dlp import YoutubeDL


start_time = time.perf_counter()
ydl = YoutubeDL(params={"extractor_args": {"youtube": {"player_client": ["web"]}}})
ydl.extract_info(url=r"https://youtu.be/9BansjPtOn8?feature=shared", download=False)
end_time = time.perf_counter()

elapsed_time = end_time - start_time

print(f"Elapsed time for task(): {elapsed_time} seconds")

On a raspberry pi 4 I get the following results:

Version Time in s
Python 3.8 38s
Python 3.9 10s
Python 3.11 15s

Small update: the most time seems to be spent in the jsinterp.py
image

Any ways to speed this up?


Q2: Newbie question but why is jsinterp.py used in the first way? Isn't there an easier way to run a few lines of javascript? Or could someone explain the reason behind this :)

Kind regards

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • If using API, add 'verbose': True to YoutubeDL params instead
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

No response

@mokrueger mokrueger added the question Question label May 6, 2024
@dirkf
Copy link
Contributor

dirkf commented May 7, 2024

Isn't there an easier way to run a few lines of javascript?

Do tell us ... see #1354.

Most other solutions involve starting up a web browser, or Node.js, to run the JS, and/or are not compatibly licensed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question
Projects
None yet
Development

No branches or pull requests

2 participants