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

Efficient version ranges #14

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

krishgalani
Copy link

@krishgalani krishgalani commented Aug 23, 2024

Please read commit logs for verbose changes!
let me know your thoughts :) @iamdual

modified one test and added a new unit test

kgala added 2 commits August 22, 2024 21:40
version-range queries, I believe this is not neccesary, as you have to store more overhead.
Currently we have O(|versions|) per query
regardless of if a recent generate with the same browser/platform
version_ranges provided. This is evident in the VersionRanges class
filter method. I have modified the initialization module (where the
generate method is) to dynamically initialize index maps at most once
per type of browser/platform range specified. This initialization
direcly modifies a index map field in the browsers/platforms modules
which remains throughout generates. This reduces the time
complexity from O(|versions|) per query to O(|versions|) on the first,
and O(1) for the rest. This is to be expected for a ua-generator, as it
is commonly used as a small piece of many webscraping algorithms.
Changes:
Initialize the relevant index map when the version_ranges feature is used.
Use index-maps for faster version filtering.
Provide error checking for version correctness instead of ignoring the
error. This means creating a new exception for invalid version.
A unit test of the functionality. (I also did some print statement
tests)
@iamdual
Copy link
Owner

iamdual commented Aug 24, 2024

Hello, I will take a look when I find time, but doesn't seem urgent. 🤔

kgala added 7 commits August 26, 2024 22:03
…roid_pixel), wouldn't be recognized by generator and throw an error, this is an extension to allowing the user to specify a specific android platform or version. At the same time produce more verbose generator errors (this means adding to_string methods in Version, VersionRange, and Options). Finally add a constant ANDROIDS containing all the possible android platforms that can be specified, 'android' is still supported, and a specific platform will be chosen for the user
… once at import, instead of across generates. Also include better type checking for version_ranges
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants