-
-
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
tab completion hinting slows down paste on Windows #56884
Comments
Seems like that we should use this command Base.active_repl.options.hint_tab_completes = false But this command cannot be executed at PS just as uncomfortable as ios18, which removes the video review bar in its photos app, what a pity. |
My guess is that in windows the REPL see this as just entering characters quickly (since no bracket paste mode) and the tab complete suggestion will run after every character. This would indeed slow things down. |
Maybe it's true for windows. We really don't need this superfluous prompt. If I want to, I can press Tab handily. By the way, is there any other method to speed up? Since I catch this problem today. There is a saying: "I could have withstood darkness, if I had never seen brightness". If I learn Julia from version 1.11.2, I would recognize this 10 seconds for 100 line of code as a normal speed. 💀 |
I tried to emulate this with |
@WalterMadelim the instructions to disable tab complention hinting in startup.jl is here and here
We need to figure out how to implement cancelling completion generation on the next keystroke. It's discussed here #55434 (comment) |
Otherwise, is there any way to identify when stuff is being pasted in in Windows, so we can disable hinting temporarily? |
@IanButterworth Thanks, it works. |
@IanButterworth, we could maybe piggy back on julia/stdlib/REPL/src/options.jl Lines 26 to 27 in dde5028
|
Can a windows user check the proposed fix here #56895 |
Bump. @WalterMadelim are you able to check #56895 ? |
@IanButterworth I'm using win11. But I don't know how to check 🤨. |
If you're using juliaup (i.e. you've installed Julia from the windows store e.g. via You should only do this if you trust the master version of Julia and have either reviewed the diff at https://github.com/JuliaLang/julia/pull/56895/files or trust @IanButterworth (a reasonable choice if you're not a high risk target because he has write access to this repo). When you're done, you can uninstall that version of Julia with |
@LilithHafner I see. But I am more familiar with the windows 64-bit portable release.
Is there a way to bypass the juliaup. Maybe like to install a specific version of a package. Or you can adopt this update boldly and release 1.11.3, I'll test it there immediately after releasing. I think it won't cost much. |
You can find the binary by navigating to #56895, clicking "show all checks", clicking "details" next to the build step, finding the "build x86_64-w64-mingw32" job and opening the "artifacts" tab. Here's a direct link: https://buildkite.com/organizations/julialang/pipelines/julia-master/builds/43230/jobs/0193f498-ac54-4871-a7b0-6331cd4fc6fa/artifacts/0193f4b8-d403-4ae0-aa3e-f28be0e2e5bd. |
@LilithHafner I've downloaded that artifact and tried it. @IanButterworth I'm afraid that this version is unusable. I'll list some experiences below. A pristine welcome page is like this: Microsoft Windows [Version 10.0.22631.4602]
(c) Microsoft Corporation. All rights reserved.
K:\julia_new\julia-f812726e6e\bin>julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.12.0-DEV.1783 (2024-12-23)
_/ |\__'_|_|_|\__'_| | IanButterworth:ib/repl_hint_paste_off/f812726e6e (fork: 1 commits, 19 days)
|__/ |
�[0K�[32m�[1mjulia> �[0m�[0m
�[7C
�[7C Then I type K:\julia_new\julia-f812726e6e\bin>julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.12.0-DEV.1783 (2024-12-23)
_/ |\__'_|_|_|\__'_| | IanButterworth:ib/repl_hint_paste_off/f812726e6e (fork: 1 commits, 19 days)
|__/ |
�[0K�[32m�[1mjulia> �[0m�[0m
�[7C
�[7Cabcdefg
�[0K�[32m�[1mjulia> �[0m�[0m
�[7Cabcdefg
�[14C
�[?2004l�[0m�[91m�[1mERROR: �[22m�[39mUndefVarError: `abcdefg` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
�[0K
�[0K�[32m�[1mjulia> �[0m�[0m
�[7C
�[7C�[?2004hm�[0m
�[7C
�[7Culia> �[0 The above 2 blocks are tested with the windows cmd. When I test it in VScode, which uses PowerShell, it looks like PS K:\uc24> julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.12.0-DEV.1783 (2024-12-23)
_/ |\__'_|_|_|\__'_| | IanButterworth:ib/repl_hint_paste_off/f812726e6e (fork: 1 commits, 19 days)
|__/ |
julia> abcdefg
ERROR: UndefVarError: `abcdefg` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
C Notice that it is not returned, (i.e., there is not a new julia> prompt). Finally, I copy the 100-line quote-end block in my first comment in this webpage and paste it to the PowerShell terminal in VScode. And the outcome looks like PS K:\uc24> julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.12.0-DEV.1783 (2024-12-23)
_/ |\__'_|_|_|\__'_| | IanButterworth:ib/repl_hint_paste_off/f812726e6e (fork: 1 commits, 19 days)
|__/ |
julia> quote C
function one(cb_data, cb_where::Cint)
Notice that it gets stuck at the second line, and at the rightmost end of line 2, there is a Captital C.. When I press enter, the status is unaltered. After an reversion to 1.11.2 with the modification in my startup.jl, things became normal. |
I think I've fixed the issue in #56895 (at least it works as expected for me in a windows VM) |
@IanButterworth Unfortunately you didn't. 🥲. The refreshing process is still word-by-word, hence slow. (The animation looks smooth though) (But we don't want animation, we merely want to paste our code asap). K:\julia2\julia-921a1ff33e-windows-x86_64\julia-921a1ff33e\bin>julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.12.0-DEV.1849 (2025-01-07)
_/ |\__'_|_|_|\__'_| | IanButterworth:ib/repl_hint_paste_off/921a1ff33e (fork: 3 commits, 0 days)
|__/ |
julia> quote
julia> quote
function one(cb_data, cb_where::Cint)
julia> quote
function one(cb_data, cb_where::Cint)
jvcb_scalar(x) = JuMP.callback_value(cb_data, x)
julia> quote
function one(cb_data, cb_where::Cint)
jvcb_scalar(x) = JuMP.callback_value(cb_data, x)
jvcb(x) = jvcb_scalar.(x)
julia> quote
function one(cb_data, cb_where::Cint)
jvcb_scalar(x) = JuMP.callback_value(cb_data, x)
jvcb(x) = jvcb_scalar.(x)
cb_where == Gurobi.GRB_CB_MIPSOL || return
julia> quote
function one(cb_data, cb_where::Cint)
jvcb_scalar(x) = JuMP.callback_value(cb_data, x)
jvcb(x) = jvcb_scalar.(x)
cb_where == Gurobi.GRB_CB_MIPSOL || return
Gurobi.load_callback_variable_primal(cb_data, cb_where)
julia> quote
... (omission) One more noteworthy point which is different from my initial report 2 weeks ago is that the final remaining code on the screen has color. e.g. keywords quote, function, end are red, true and @error are pink, strings are in green, and name of functions while invoking are in blue. The auto-completion works properly though. The "duplications remnant" mentioned above is not in this patch release alone. This phenomenon also exists if I revert to 1.11.2 with my startup.jl file modified to ban auto-completion. But that is tolerable insofar as I can paste quickly. |
Seems improved to me. Are you seeing slower than this? Screen.Recording.2025-01-07.at.1.34.57.PM.mov |
@IanButterworth The resullts in your video is fast. However this is not for me. I use windows cmd also and the julia version is Microsoft Windows [Version 10.0.22631.4602]
(c) Microsoft Corporation. All rights reserved.
K:\julia2\julia-921a1ff33e-windows-x86_64\julia-921a1ff33e\bin>julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.12.0-DEV.1849 (2025-01-07)
_/ |\__'_|_|_|\__'_| | IanButterworth:ib/repl_hint_paste_off/921a1ff33e (fork: 3 commits, 1 day) If I configure my startup.jl file to ban autocompletion, the result is 3 seconds. The default setting is: After adding |
Can you try increasing this threshold and if it helps figure out what the lowest good value is.
|
It seems it won't help by tuning this parameter to some value. |
What values did you try? |
@IanButterworth any value such that 1e-5 ≤ value ≤ 1e-1 There is few differences by tuning this parameter: The cursor just move from left to right, then from top to bottom. As a comparison, if I add that line to ban this hint, the motion is visibly different. It just refresh line by line. Or, if I just press 'ctrl + D' to quit julia REPL, and revert to the windows cmd, then I paste that 100-line quote-end code block (although this behavior is pointless), The motion will be substantially faster. |
Do you mean no difference? Or if you mean there is a difference (I.e. speed improvement), what value does it start at? |
@IanButterworth I did a test, with the help of 'time()', let's see the results. # [ Info: value = 0.005, time_spent = 8.123999834060669
# [ Info: value = 0.0075, time_spent = 7.429999828338623
# [ Info: value = 0.01125, time_spent = 7.184999942779541
# [ Info: value = 0.0253125, time_spent = 6.797999858856201
# [ Info: value = 0.056953125, time_spent = 6.625999927520752
# [ Info: value = 0.12814453125, time_spent = 6.748000144958496
# [ Info: value = 0.5, time_spent = 6.692000150680542
# [ Info: value = 1.0, time_spent = 6.880000114440918 If I ban auto-completion in startup.jl then [ Info: value = 0.005, time_spent = 1.8029999732971191 If I switch julia to 1.9.4, then [ Info: value = 0.005, time_spent = 1.434000015258789 Test code is: Base.active_repl.options.auto_indent_time_threshold = some_value
t0 = time()
# code block
@info "value = $(Base.active_repl.options.auto_indent_time_threshold), time_spent = $(time() - t0)" For every experiment, I open a pristine julia REPL and execute only once. Of course by pasting, not |
I use win11. The text editor is VScode. I use the portable version of Julia release.
If a block of code is copied from a *.jl text file, and pasted to a julia REPL in VScode, then the code can be checked and executed.
This workflow worked well, until yesterday I decided to use the latest stable release of Julia, which is 1.11.2.
Then I found that the code refreshing speed is manifestly slowed, compared with the previous version (1.10.2).
Could you tell me the reason and ways to sort it out?
I really did an experiment to exhibit this difference. For a 100-line code block, If 1.10.2 is used, the finishing time of code checking is 1.87 seconds.
If 1.11.2 is used, the time is 10.55 seconds.
(in Julia REPL, after the code is pasted)
The code review process of 1.10.2 seems to be line-by-line and it is fast, which is pleasant.
But the code review process of 1.11.2 seems to be word-by-word and it is very slow, which is annoying.
I append the code block (it is an expression indeed, you can easily use another block instead) here for convenience
The text was updated successfully, but these errors were encountered: