Faster C# array access

In .Net memory access is safe by default. This means that every time you access an array item the index is checked against the length of the array. In this post I explore how you can speed up plain old array access 18%-34% by convincing the compiler it can skip some checks. I compile the … Read more

sizeof() vs Marshal.SizeOf()

To get the size of a data type in .Net you can use   or  . I’ll briefly explain the difference between the two. sizeof()   (MSDN) can only be used on data types that have a known size at compile-time. It is compiled as a constant. If you attempt to use it on invalid … Read more

Cost of method wrapper

Introduction What happens if a method is just a wrapper for another method? Is the extra jump optimized away by compiler? Does it take much time? I thought I’d look into this and measure a bit. With the different compilers, Jits and runtimes I thought it would be fun to see what happens. I’ll use … Read more

Small milestone reach today

Application is now able to: Create Script Engine (SE) SE hooks up to a temporary debug event in Test App Test App asks SE to load LSO-file SE compiles LSO-file into .Net Assembly SE loads .Net Assembly SE Initializes the .Net Assembly and hands over a “LSL BultIn Commands” object (this object is the scripts … Read more

Status on initial SE implementation

With the model described in the two prior postings we will have simple scripts support up and running fairly quickly. Other developers will be able to extend script support while I continue working on Compiler and ScriptEngine. Both incoming events and outgoing LSL builtin commands needs extending. We will lack script yield inserting. This is … Read more

ScriptEngine – Events

The builtin commands for SE is simple enough. But incoming events could need some more planning. SE will have a set of events that is fired based on stuff that happens in OpenSim (EventHandler). This EventHandler will translate the event into a LSL-compatible event, including picking up the required parameters. The EventHandler needs to know … Read more

ScriptEngine

The time has come to start implementing script support into OpenSim. ScriptEngine (SE)OpenSim will have an interface for SE. It will load SE dynamically using reflection. SE will be in separate .dll Assembly.During load SE will hook itself up to the necessary events in OpenSim.This includes: Object rez (look for active scripts), object derez and … Read more

Frames, heap and code pointers

LSL ByteCode uses a lot of pointers, both to memory (static frames, local/global, heap) as well as JUMP pointers. Some of these pointers exist during load, for example argument types, static data, jump positions, etc. While others are allocated and created dynamically during run-time. What they all have in common is that they point to … Read more

Stack issues

In my first attempt I used the .Net stack and did a direct translation from the LSO ByteCode. I found that there are a couple of problems related to that. First of all is the obvious problem that I stated earlier, I don’t know what datatype is in the stack – but many (most) .Net … Read more