-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
improve --heap-size-hint
arg handling
#48050
Changes from all commits
c4c5229
da564a7
e7fb5dd
84cbd0e
fa2d281
3b889d4
35dc093
5f32478
7495e55
2974896
1291220
a7e1bb3
07fbf57
3de28b5
b902aab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1148,3 +1148,19 @@ if Sys.islinux() && Sys.ARCH in (:i686, :x86_64) # rr is only available on these | |
"_RR_TRACE_DIR" => temp_trace_dir); #=stderr, stdout=#)) | ||
end | ||
end | ||
|
||
@testset "--heap-size-hint" begin | ||
exename = `$(Base.julia_cmd())` | ||
@test errors_not_signals(`$exename --heap-size-hint -e "exit(0)"`) | ||
@testset "--heap-size-hint=$str" for str in ["asdf","","0","1.2vb","b","GB","2.5GB̂","1.2gb2","42gigabytes","5gig","2GiB","NaNt"] | ||
@test errors_not_signals(`$exename --heap-size-hint=$str -e "exit(0)"`) | ||
end | ||
k = 1024 | ||
m = 1024k | ||
g = 1024m | ||
t = 1024g | ||
@testset "--heap-size-hint=$str" for (str, val) in [("1", 1), ("1e7", 1e7), ("2.5e7", 2.5e7), ("1MB", 1m), ("2.5g", 2.5g), ("1e4kB", 1e4k), | ||
("1e100", typemax(UInt64)), ("1e500g", typemax(UInt64)), ("1e-12t", 1), ("500000000b", 500000000)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm, clearly I did not look closely enough before: I thought this was about adding support for inputs like But is a heap size hint of the form I guess it would be more work to not support them, though. Ah well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR doesn't change the numeric syntaxes supported here — it just adds tests for them. The big change here isn't about the supported numeric values, but rather the byte unit. Before Julia would silently discard/ignore unrecognized units. After this PR, Julia errors. That's the big improvement. Currently:
After:
|
||
@test parse(UInt64,read(`$exename --heap-size-hint=$str -E "Base.JLOptions().heap_size_hint"`, String)) == val | ||
end | ||
end |
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.
So, let me recap: this PR changed things to use
tolower
, which has issues, so it was suggested to useutf8proc_tolower
instead which then was replaced by this hand-written function...How about my original suggestion to just stick with what the code did before this PR, and simply have two cases in the
switch
for each letter? That seems by far simplest and is guaranteed to have no UTF-8 related issues or anything else and requires no additional explanation?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.
Haha, yeah. But this works too, and there are a couple extra cases now, including one that is not in a switch statement, so it is not entirely obvious to me that it is significantly better one way or the other; just a style preference.