Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite `@wrap`, `@gapwrap` and `@gapattribute` to not use `@generated` anymore: we used that as a trick to delay loading of certain objects from GAP to runtime; but this was always brittle and will fail in the future when Julia becomes more effective and aggressive precompilation support. We replace this with a simpler approach where the GAP objects now really are only loaded at runtime, and store in global `const Ref{GapObj}` variables. This is in theory slightly less efficient (as now every function call has to check whether the `Ref` is already assigned), but this is tiny. In practice we still have a noticeable improvement over directly calling the relevant GAP functions. Indeed: Before this patch: julia> @Btime GAP.Wrappers.IsString(1); 6.125 ns (0 allocations: 0 bytes) julia> @Btime GAP.Wrappers.String(1); 154.647 ns (6 allocations: 160 bytes) After this patch: julia> @Btime GAP.Wrappers.IsString(1); 9.844 ns (0 allocations: 0 bytes) julia> @Btime GAP.Wrappers.String(1); 156.197 ns (6 allocations: 160 bytes) For reference, without the wrappers (same before and after this patch): julia> @Btime GAP.Globals.IsString(1); 35.624 ns (0 allocations: 0 bytes) julia> @Btime GAP.Globals.String(1); 182.200 ns (6 allocations: 160 bytes) This patch is motivated by JuliaLang/julia#36770 and JuliaLang/julia#43990
- Loading branch information