-
Notifications
You must be signed in to change notification settings - Fork 102
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 random_replacetext, a replacement for stars() #168
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think this is worth the compile time of 2 seconds max, much less the maintainer overhead and me having to write this sentence
So, let's put into perspective why this is useful. This proc, on TG, is labelled as so expensive you should never use it. It used to be a crash vector on Paradise. This proc used to be used alot, but was scrubbed away because of the cost it incurred. Besides, this code is braindead simple (because im braindead and I wrote it), maintaining it isn't exactly a challenge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blocking: feature not documented properly in code nor in readme
if you can get another maintainer not from daedalus to care about this we can merge it
}); | ||
|
||
fn replacetext(text: &str, prob_as_str: &str, replacement_str: &str) -> Result<String> { | ||
let prob = prob_as_str.parse::<u32>()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered how this error will propagate up?
Adds a new function,
random_replacetext()
, which randomly replaces non-whitespace characters in a string with another character. This is to replace thestars()
function found in every SS13 codebase, which is awfully, awfully slow due to byond's string interning.Please ignore the overtime values for this, as I simply ran each proc 10,000 times in the same tick.
![image](https://private-user-images.githubusercontent.com/75460809/322409827-6ff70f7f-026e-47bf-8df6-7e88928f34c6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMjM2ODgsIm5iZiI6MTczOTAyMzM4OCwicGF0aCI6Ii83NTQ2MDgwOS8zMjI0MDk4MjctNmZmNzBmN2YtMDI2ZS00N2JmLThkZjYtN2U4ODkyOGYzNGM2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDE0MDMwOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRkMWUwNjg5MWU4ODcyZGUwZjdmZGI1NTI3NTU5YWYwZjRlNzllZTQwYzQ2MzY0NTU2ODliZjU4ZTRmYTMwNmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.1cCoLhKLhF3I_ZhNWofSOWfJKeYwawdNMyJd_RrjBSQ)