made gc modification optional
This commit is contained in:
parent
fabb6bed00
commit
48ec718757
@ -4,22 +4,23 @@ import logging
|
||||
import re
|
||||
|
||||
from . import objects, pages
|
||||
from .utils.shared import MUSIC_DIR, NOT_A_GENRE, get_random_message
|
||||
from .utils.shared import MUSIC_DIR, NOT_A_GENRE, MODIFY_GC, get_random_message
|
||||
|
||||
|
||||
"""
|
||||
At the start I modify the garbage collector to run a bit fewer times.
|
||||
This should increase speed:
|
||||
https://mkennedy.codes/posts/python-gc-settings-change-this-and-make-your-app-go-20pc-faster/
|
||||
"""
|
||||
# Clean up what might be garbage so far.
|
||||
gc.collect(2)
|
||||
if MODIFY_GC:
|
||||
"""
|
||||
At the start I modify the garbage collector to run a bit fewer times.
|
||||
This should increase speed:
|
||||
https://mkennedy.codes/posts/python-gc-settings-change-this-and-make-your-app-go-20pc-faster/
|
||||
"""
|
||||
# Clean up what might be garbage so far.
|
||||
gc.collect(2)
|
||||
|
||||
allocs, gen1, gen2 = gc.get_threshold()
|
||||
allocs = 50_000 # Start the GC sequence every 50K not 700 allocations.
|
||||
gen1 = gen1 * 2
|
||||
gen2 = gen2 * 2
|
||||
gc.set_threshold(allocs, gen1, gen2)
|
||||
allocs, gen1, gen2 = gc.get_threshold()
|
||||
allocs = 50_000 # Start the GC sequence every 50K not 700 allocations.
|
||||
gen1 = gen1 * 2
|
||||
gen2 = gen2 * 2
|
||||
gc.set_threshold(allocs, gen1, gen2)
|
||||
|
||||
logging.getLogger("musicbrainzngs").setLevel(logging.WARNING)
|
||||
musicbrainzngs.set_useragent("metadata receiver", "0.1", "https://github.com/HeIIow2/music-downloader")
|
||||
|
@ -7,6 +7,11 @@ from sys import platform as current_os
|
||||
from pathlib import Path
|
||||
import random
|
||||
|
||||
# modifies the garbage collector to speed up the program
|
||||
# https://mkennedy.codes/posts/python-gc-settings-change-this-and-make-your-app-go-20pc-faster/
|
||||
# https://web.archive.org/web/20221124122222/https://mkennedy.codes/posts/python-gc-settings-change-this-and-make-your-app-go-20pc-faster/
|
||||
MODIFY_GC: bool = True
|
||||
|
||||
"""
|
||||
I will now and then use those messages in the programm.
|
||||
But I won't overuse them dw.
|
||||
@ -22,7 +27,7 @@ HAPPY_MESSAGES: List[str] = [
|
||||
"🏳️⚧️🏳️⚧️ Trans women are women, trans men are men. 🏳️⚧️🏳️⚧️",
|
||||
"🏴☠️🏴☠️ Unite under one flag, fuck borders. 🏴☠️🏴☠️",
|
||||
"Join my Matrix Space: https://matrix.to/#/#music-kraken:matrix.org",
|
||||
"Gotta love the BPJM!! :/"
|
||||
"Gotta love the BPJM!! >:("
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user