-
Notifications
You must be signed in to change notification settings - Fork 14
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
Extracting "ascii images" to files #36
Comments
Yes, this is something I was thinking about, too. It is a great idea to have a seperate file, where the user will be able to overide any icon\profile of any already existing-or-not extension, but...
It's nice to have, all the default icons\profiles preloaded into My thoughts on how it should be implemented:
And such, if Feel free to do so if you feel confident about it and have the necessary time for it. As of now I'll probably go to sleep in a while and when I wake up tomorrow, most likely I'll work on using custom commands inside tuifi |
I'm not sure how you are bench marking your code, but it's seems to me that even loading thousand of files wouldn't impact at all the speed of the preload:
from random import randint
for i in range(1000):
data = ''.join(chr(randint(0, 255)) for _ in range(500))
with open(f'icons/test_file_{i}.txt', 'w') as f:
content = f.write(data)
import pathlib
from time import perf_counter
marker = perf_counter()
store = {}
def chunk(line, size):
return '\n'.join(line[i:i+size] for i in range(0, len(line), size))
for i in range(1000):
filename = f'icons/test_file_{i}.txt'
content = pathlib.Path(filename).read_text()
store[filename] = chunk(content, 10)
print(store)
elapsed = perf_counter() - marker
print(f"> {elapsed * 1000:,.5f} ms")
I took about 60 millisecond with a pretty much beyond worse case scenario |
it already takes about 3 seconds to startup on my 2016 debloated phone :P There are going to be more features and that 10ms will be 20 and 30 and go on with each release. Having to construct and alocate memory for each TUIFIProfile on the go for every each icon while reading a file line by line, doesn't sound a good idea by default. Don't you think that it's better to have the icons in |
Well, i'm not sure that trying to squeeze every bit of performance when writing python code is a good practice. I think you should prioritize a cleaner codebase here and maybe create some kind of light mode if you really wanna run it on your phone. I don't think you'll be able to easily reduce that startup time for your device, without scarifying features and getting into the ugly parts of python. Btw, i don't think that making a lot of memory allocation is a huge problem in python. The language as a ton of abstraction and talking about memory allocation often just don't makes a lot of sense. Every objects will allocate more memory than your average C code, but python has it own memory management system called pymalloc to optimize small allocations. Moreover, It would be terrible to drop possible improvements as i think this as a lot of potential. Your are the owner of the repo, so the decision is up to you |
I won't, this feature will definitely be implemeted. I just can't see why it would be better to have all the default icons removed from the |
(Btw thank you for helping me out <3 on this project, I do really appreciate it) |
Maybe I'm missing something, idk |
It would be really nice to have a separation for the ASCII files icons into their own files outside the codebase.
This would make organization easier, adding new files type an easy manner and improve the possibility for customization.
I would think of having metadata along the ascii art, such a the file extensions.
For later on it could be a way to add better / small icons too while keeping the code clean with a simple loader helper
The text was updated successfully, but these errors were encountered: