Skip to content

RFC: Shorten tags by using the objectid of the function instead of di… #572

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

ChrisRackauckas
Copy link
Member

…rectly the function

Right now duals of duals of duals have an exponential growth in the type name because the functions then to have closures which hold values with the values, so as you begin to nest you see the previous nest in the function type (multiple times). This makes the tag always the same size. julia> objectid(typeof(f)) #0x0000000006be1dbe. Now instead of a massive tag you just get a small tag, but it's some essentially random number. But it's not random in the sense of always being different: it is a deterministic hash:

julia> f(x) = x
f (generic function with 1 method)

julia> objectid(typeof(f))
0x0000000006be1dbe

so it plays the same as before with precompilation. Is this a good idea?

…rectly the function

Right now duals of duals of duals have an exponential growth in the type name because the functions then to have closures which hold values with the values, so as you begin to nest you see the previous nest in the function type (multiple times). This makes the tag always the same size.  `julia> objectid(typeof(f)) #0x0000000006be1dbe`. Now instead of a massive tag you just get a small tag, but it's some essentially random number. But it's not random in the sense of always being different: it is a deterministic hash:

```julia
julia> f(x) = x
f (generic function with 1 method)

julia> objectid(typeof(f))
0x0000000006be1dbe
```

so it plays the same as before with precompilation.  Is this a good idea?
@thomvet
Copy link
Contributor

thomvet commented Feb 6, 2022

Since I have a few nested differentiations occurring in my codes, I am supportive of a change that shortens tags and makes stacktraces more readable as a result - is there an improvement possible in the sense that we do not completely lose the significance of the tag (i.e., stays human readable), while it's still shorter? Would that not carry the best of both worlds?

@mcabbott
Copy link
Member

It's been a while but shall we do this? As one more change to lump into 0.11 or 1.0 or whatever the next release ends up being.

Are we reasonably sure it's zero-cost?

@ChrisRackauckas
Copy link
Member Author

Julia v1.10 made stack traces smaller, I think this isn't needed anymore.

@ChrisRackauckas ChrisRackauckas deleted the ChrisRackauckas-patch-1 branch April 29, 2024 12:05
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants