Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

[Suggestion] Please fix opcodes from vb compiler when initialize an array and function local variant.

$
0
0

Hi guys,

I want to point out some flaw opcodes that vb compiler create and hope VB dev team have sometime to fix those and make VB better performance.

1. Array

When I create an array like this "Dim Data(input.Length - 1) As Char", compiler will rewrite to "Dim Data(input.Length - 1 + 1) As Char"; it's unnecessary 4 bytes and you loss 4 of 64 bytes if you aim to create a tiny method.

2. Function local variant

VB function away has self local variant like "Function foo() As string" will have "Dim foo As String" even it's unused and it bad for performance when you aim to create tiny method header, even a single local variant will make it become a fat method header.

3. Optional to invoke method by jmp

Jump invoke might be not fast as call or callvirt but it's safe for a stack overflow error and recursive method.

4. Delegate invoke

Instead to use invoke method of delegate class, make it become sugar syntax.

ldfld obj Delegate::ThisObj
ldfld int Delegate::MethodPtr
//Some arguments
calli void(arguments) //maybe has a field stock method signature could helpful to do this line.

Cost for invoke method is really high, less method invoke more performance.


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>