Coder Social home page Coder Social logo

saladdais / lso2-vm-performance Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 195.38 MB

LSO2 VM for Second Life, but faster maybe?

Shell 0.49% CMake 2.17% C++ 85.63% Python 2.29% HTML 5.18% C 2.36% Objective-C++ 0.03% Batchfile 0.01% Lex 0.57% Yacc 0.49% Perl 0.02% C# 0.37% LSL 0.38%
secondlife second-life lsl

lso2-vm-performance's Introduction

LSO2 VM Performance

Summary

Repo to figure out why the LSO2 LSL VM is so slow, and maybe make it a bit faster.

Includes a lscript_harness binary that runs the state_entry() of an LSL script under the LSO2 VM to allow for benchmarking performance improvements.

Why?

Even though Mono has existed for over a decade, people continue to write scripts targeting LSO2. So long as those scripts continue to be supported, sims will have to spend some of their execution budget on evaluating them. Improving script engine performance isn't just important for scripts, improving script engine performance also improves sim performance.

Benchmarks

Benchmark runtime comparison (in seconds):

Benchmark Unmodified VM Modified VM
Mandelbrot 0.31 0.08
NSieve 0.17 0.11
Recursion 0.008935 0.001847

Obvious improvement possibilities

Focusing on improvements that don't involve bytecode or state serialization changes:

  • Stop leaving the interpreter loop to check for conditions that can't happen given the current instruction (done)
    • State changes, whatever else. (done)
  • Only perform yield checks on backwards jumps, function calls, and returns, like Mono scripts. (done)
  • Move opcode handlers from functions to computed goto / switch statement.
  • Make VM registers native-endian, swapping to big-endian when (de)serializing VM state (done)
    • Ideally all stack and heap data should be made native-endian, that's much more involved if we want to maintain compatibility with existing VM state serialization. Would need ability to map current IP to the type of the stack contents, walking up the call stack. Maybe not possible.
  • Disable safety checks that only matter if untrusted bytecode is evaluated
    • Naturally, this is trickier since SL accepted arbitrary bytecode for a long time. Could only flag on those optimizations for scripts that proved stored_bytecode == compile(stored_source)

License

This patchset is applied on top of Firestorm for demo purposes, Firestorm is licensed under the LGPL v2.1.

The diffs of any commits written by me in https://github.com/SaladDais/LSO2-VM-Performance/compare/ee368a40fc777d8ea7ea7ac66fa5bafd89579996~1...lscript_only (excluding the LSL benchmarks / conformance tests) may be used under the terms of public domain, ISC, LGPL v2.1 or Apache v2 licenses. Whatever your lawyers prefer.

Note that the code will probably become LGPL v2.1 when applied unless you're the original copyright holder for the SL viewer.

All documents and designs in these diffs authored by me have the same licensing terms as above and may be used without attribution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.