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

add stub test script #49

Merged
merged 6 commits into from
Apr 21, 2024
Merged

add stub test script #49

merged 6 commits into from
Apr 21, 2024

Conversation

Andriamanitra
Copy link
Owner

No description provided.

Copy link
Collaborator

@ellnix ellnix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script looks good, There could be refactoring to make it more readable but I don't think that's worth doing at a file this size. It's perfectly understandable even for a noob like me.

I think the thing you could improve is to make this multi threaded. I don't know how multi threading works in python, but if it's anything like Rust it should be easy to partition the clashes in thread_count places and then run the check_stubgen command for each lang in each thread with their own subsample of clashes. That should also avoid having all the "expensive" languages in one slow thread.

if n is not None:
clash_ids = random.sample(clash_ids, n)

GCC_CMD = ["gcc", "-fsyntax-only", "-x", "c", "-"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could probably be a map of arrays? If every language has a single command.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea, I put the languages into a dict so it's easy to comment out or add languages

@daxida
Copy link
Collaborator

daxida commented Apr 19, 2024

Is this something intended to be run for every language where we support a template? I just vaguely recall using it only for C and I'm surprised to see that loop over three languages.

How fast it fares for both of three if you happen to remember?

@Andriamanitra
Copy link
Owner Author

Is this something intended to be run for every language where we support a template? I just vaguely recall using it only for C and I'm surprised to see that loop over three languages.

Nah it doesn't need to support every language, just the ones that are easy to check. I skipped interpreted languages for now because I don't really want to actually run the code. Maybe there's some static tooling that could help with those? The more we can test the better.

How fast it fares for both of three if you happen to remember?

I've just left it running in the background for a while so I don't know how long it took exactly, but with these 3 languages it does about 5 clashes per second so that should be around 10 minutes for all 2776 clashes. I don't expect it to be ran very often so I'm not too worried about the speed.

@Andriamanitra Andriamanitra mentioned this pull request Apr 20, 2024
@Andriamanitra Andriamanitra merged commit 625cf7c into main Apr 21, 2024
2 checks passed
@Andriamanitra Andriamanitra deleted the stubgen-test-script branch May 20, 2024 18:42
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.

3 participants