Aggressive optimization and inlining foor PooledList.Span
See original GitHub issueIs your feature request related to a problem? Please describe. Next method is kind of slow in Unity runtime (not sure about Core):
public Span<T> Span => _items.AsSpan(0, _size);
Describe the solution you’d like Mark this method as aggressive optimization and inlining.
Describe alternatives you’ve considered Provide unsafe access to writable array as ReadOnlyProperty.
Additional context We get data from Span by ref.
I know Core 3 optimized Span, but there are issues to measure that because of BDN-JIT instability. Same time Unity is involved into .NET Ecosystem and hopefully will optimize Span in some time (because people will use .NET Standard with Spans and Unity stated it is 2.0 and will be 2.1)
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Is there a downside to using AggressiveInlining on simple ...
Inlining is one of them, whether the programmer wanted or not. For example, MethodImplOptions does not have an "inline" option. Because inlining ......
Read more >c# - Specifically what does a compiler do to aggressively ...
Strip all symbols from a module; Strip debug info for unused symbols ... Here are two simple optimizations a compiler could make:
Read more >Inlining and Compiler Optimizations
More interestingly, though, inlining enables other compiler optimizations. In this article, I will show examples of constant propagation and ...
Read more >3.11 Options That Control Optimization
Consider all functions for inlining, even if they are not declared inline. The compiler heuristically decides which functions are worth integrating in this...
Read more >Methods to Optimize Code Size
The browser version you are using is not recommended for this site. Please consider upgrading to the latest version of your browser by...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for the delayed response. Here’s what I’m currently seeing without your suggested optimization, run from the “core3” branch:
And here’s what I’m seeing with AggressiveInlining applied to the “Span” property getter. There doesn’t seem to be a significant change by doing this. Perhaps I’m misunderstanding what you’re proposing?
MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization ? It may not help either. But at least, in Unity IL2CPP both span and index were slow, so people put items array as public. So if nothing changes, may be leave both optimization in place so that possible other runtimes will have more chances to hit the optimization? Just as idea, but anyway - may close the issue. Thanks