-
-
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
add faster done for strings #18259
add faster done for strings #18259
Conversation
Candidate for backport too? |
there are not many string benchmarks but anyway... @nanosoldier |
Your benchmark job has completed - no performance regressions were detected. A full report can be found here. cc @jrevels |
Oh.. Used the wrong invocation.. |
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels |
I cannot reproduce the join regression and it has been noisy on many other benchmark runs. I can reproduce the performance gain in for example |
Does this do the right thing for unicode? Could really use more tests on the correctness here in corner cases. |
Won't Lines 36 to 43 in 28f1306
|
ok julia> for x in String([0xcf, 0x83, 0x83, 0x83, 0x83])
print(x)
end
σ
------------------------------------------------------------------------------------------
UnicodeError Stacktrace (most recent call last)
[#3] — anonymous
⌙ at <missing>:?
[#2] — next;
⌙ at string.jl:92 [inlined]
[#1] — slow_utf8_next(::Array{UInt8,1}, ::UInt8, ::Int64)
⌙ at string.jl:67
UnicodeError: invalid character index |
Should have a fix. |
I thought that an iterator that carried along the endof value would work but it seems that there are many places in base that assumes that |
This reverts commit 30ee10b.
Looks like (part of) the issue is that in function f(s::String)
for c in s
c == 'a' && return true
end
return false
end We should investigate the reason for the differences. Maybe the compiler cannot guarantee that |
Do we really need this to work on invalid UTF8? The added test has an overlong encoding, which is not permitted. |
Passing in additional information with |
* Revert "add faster done for strings (JuliaLang#18259)" This reverts commit 30ee10b. * add test that failed with JuliaLang#18259
@nalimilan It is not possible to force hoisting here because |
I'm not opposed to merging #18280, but I still think we should investigate that hoisting issue fpr other string types. I didn't say that |
The problem is not related to As far as I can tell, there is no loop hoisting in the example you gave, function f(s::String)
for c in s
c == 'a' && return true
end
return false
end as the LLVM code's loop condition contains a call to L2: ; preds = %L22, %top
%"#temp#.0" = phi i64 [ 1, %top ], [ %"#temp#1.sroa.4.0", %L22 ]
%12 = call i64 @jlsys_endof_63780(%jl_value_t* %0)
%13 = icmp slt i64 %12, %"#temp#.0"
br i1 %13, label %L33, label %if |
Woops, looks like I misread the generated code. I don't remember how, though.
Yet shouldn't |
As far as I know, LLVM does not get any information assuring that the function call is pure. I don't know if it supports callsite purity annotations, but even if does, it may be non-trivial to add them. |
Yes, |
Easier said than done (for me at least :-). |
Fixes #18081
Uses @TotalVerb's suggestion in #18081 (comment)