KristofferC / OhMyREPL.jl

Syntax highlighting and other enhancements for the Julia REPL
https://kristofferc.github.io/OhMyREPL.jl/latest/
Other
749 stars 57 forks source link

REPL becomes irresponsive for some seconds if StyledStrings is loaded after OhMyREPL #355

Open lmiq opened 1 week ago

lmiq commented 1 week ago

This is the issue:

  1. Add OhMyREPL and StyledStrings
  2. load OhMyREPL (using OhMyREPL).
  3. load StyledStrings (using StyledStrings`).

Result:

The REPL is returned normally after loading StyledStrings, but becomes irresponsive for some seconds. In my computer, about 10 seconds. In the example below, the multiple julia REPLs shown at the end appear because I typed "enter" multiple times without any response:

% julia --startup-file=no
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.4 (2024-06-04)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.10) pkg> activate --temp
  Activating new project at `/tmp/jl_n7Dg7r`

(jl_n7Dg7r) pkg> add OhMyREPL, StyledStrings
   Resolving package versions...
    Updating `/tmp/jl_n7Dg7r/Project.toml`
  [5fb14364] + OhMyREPL v0.5.26
  [f489334b] + StyledStrings v1.0.2
....
  [83775a58] + Zlib_jll v1.2.13+1
  [8e850ede] + nghttp2_jll v1.52.0+1
  [3f19e933] + p7zip_jll v17.4.0+2
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`

julia> using OhMyREPL

julia> import StyledStrings

julia>

julia>

julia>

julia>

julia>

julia>

julia>

The issue does not occur in Julia 1.11.

KristofferC commented 6 days ago

I think this is due to the type piracy in StyledStrings (cc @tecosaur)

tecosaur commented 6 days ago

I'd suspect so. To backport as much from the 1.11/StyledStrings behavior as possible, the compat "1.0" release of StyledStrings redefines the generic methods for join and a few other widely-used/highly-invalidating functions.

Perhaps there's a better compromise to be struck between complete comparability and latency/invalidations? If so, I don't have much of an intuition about where to strike it.

X-refs: https://github.com/JuliaLang/StyledStrings.jl/issues/57, https://github.com/JuliaLang/StyledStrings.jl/issues/61

lmiq commented 6 days ago

But why there's a lag after the recompilation apparently finished? Waiting for recompilation is, well, ok, but having an irresponsive REPL is another kind of issue.

tecosaur commented 4 days ago

Without doing testing + profiling: no idea on my end.