Skip to content

Conversation

@kpamnany
Copy link
Collaborator

@kpamnany kpamnany commented Apr 7, 2025

PR Description

julia> Base.CoreLogging._min_enabled_level[] = Logging.Info+1
LogLevel(1)

Performance seems highly similar:

julia> @time for i in 1:10000
          @info "foo" maxlog=10000000
       end
[ Info: foo
...
  0.481446 seconds (1.33 M allocations: 89.226 MiB, 0.49% gc time)
  0.477235 seconds (1.31 M allocations: 79.002 MiB, 1.77% gc time)

Checklist

Requirements for merging:

@kpamnany
Copy link
Collaborator Author

kpamnany commented Apr 8, 2025

This doesn't work -- there are multiple changes to the order in which sub-modules of Base are loaded (in base/Base.jl) from other PRs.

@kpamnany kpamnany closed this Apr 8, 2025
@kpamnany kpamnany deleted the kp-backport-57591 branch June 27, 2025 14:41
@Drvi Drvi restored the kp-backport-57591 branch October 31, 2025 09:18
@Drvi Drvi reopened this Oct 31, 2025
Closes JuliaLang#57376
Closes JuliaLang#34037

- Adds a lock in `SimpleLogger` and `ConsoleLogger` for use on maxlog
tracking and stream writes to improve threadsafety.
Closely similar to JuliaLang#54497

- Turns the internal `_min_enabled_level` into a `Threads.Atomic`. There
are [some direct
interactions](https://juliahub.com/ui/Search?type=code&q=_min_enabled_level&w=true)
to this internal in the ecosystem, but they should still work
```
julia> Base.CoreLogging._min_enabled_level[] = Logging.Info+1
LogLevel(1)
```

- Brings tests over from JuliaLang#57448

Performance seems highly similar:

```
julia> @time for i in 1:10000
          @info "foo" maxlog=10000000
       end
[ Info: foo
...
  0.481446 seconds (1.33 M allocations: 89.226 MiB, 0.49% gc time)
```

```
  0.477235 seconds (1.31 M allocations: 79.002 MiB, 1.77% gc time)
```
@Drvi Drvi force-pushed the kp-backport-57591 branch from dcbf5d1 to 26903f2 Compare October 31, 2025 09:42
@Drvi
Copy link
Member

Drvi commented Oct 31, 2025

I've rebased the PR and moved the logging include after the concurrency includes, and that fixed the issues. I've tested the patch on RAICode here: https://github.com/RelationalAI/raicode/pull/26263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants