GithubHelp home page GithubHelp logo

doml-lang / doml.net Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 7.95 MB

The .net implementation

License: GNU General Public License v3.0

C# 95.64% HTML 0.89% R 3.47%
markup-language dot-net c-sharp c-sharp-library c-sharp-6 programming-language parsing stack doml data

doml.net's Introduction

Data Oriented Markup Language - DOML (.Net)

Uses .Net Standard 1.3

Thus supports Core 1.0+, .Net Framework/Mono 4.6+, Xamarin IOS/Mac/Android 10.0+/3.0+/7.0+, UWP 10.0+, Windows 8.1+, Windows Phone 8.1+, Windows Silverlight 8.0+

Also supports Unity (if using 2017 and using the experimental 4.6 compiler which is soon to become standard) just drag into plugins and make sure player is using 4.6 rather than the older variant and everything will work.

This is the .net implementation for DOML (Data Oriented Markup Language), which is a 'new' markup language that takes a different approach then most. It enacts to simulate a call-stack rather than simulate data structures, this allows it to represent a constructor like look rather than the usual bracketed {...} mess.

Note: Check out the proper spec if you want to see what this language can do and how to use it, for the sake of simplicity I won't repeat myself here. Furthermore this is 100% compliant with the current spec.

Deviations From The Spec

  • Counts aren't stored in parameter format once past AST, this is due to the fact that arrays have lengths associated with them.
    • Doesn't effect the outputted IR which will be valid.

Benchmarks

BenchmarkDotNet=v0.10.9, OS=Windows 10 Redstone 2 (10.0.15063)
Processor=Intel Core i5-4590 CPU 3.30GHz (Haswell), ProcessorCount=4
Frequency=3222670 Hz, Resolution=310.3017 ns, Timer=TSC
.NET Core SDK=1.1.0
  [Host]     : .NET Core 1.1.2 (Framework 4.6.25211.01), 64bit RyuJIT
  DefaultJob : .NET Core 1.1.2 (Framework 4.6.25211.01), 64bit RyuJIT
Method WithCondition Mean Error StdDev
ParseTest False 17.381 us 0.2962 us 0.2770 us
EmitTest False 16.078 us 0.2121 us 0.1984 us
ExecuteTest False 2.326 us 0.0160 us 0.0142 us
ReadIR False 7.221 us 0.0955 us 0.0893 us
ParseTest True 17.199 us 0.1040 us 0.0868 us
EmitTest True 44.816 us 0.4070 us 0.3807 us
ExecuteTest True 3.597 us 0.0292 us 0.0273 us
ReadIR True 5.646 us 0.0624 us 0.0584 us

WithConditions represents reading with/without commments, emitting with/without comments, and executing in either safe/unsafe mode

Takeaways

  • Parsing is around 17us (or ~17,000ns)
    • With/Without comments makes a miniscle difference, this is mainly due to line comments being ignored with a readline whereas whitespace is done bit by bit, so the calls cancel out the cost of creating a new instruction and placing the string in.
  • Emission is around 16us without comments, and 45us with comments
    • With comments is significantly slower due to the string manipulation that occurs, this could be optimised quite signficantly
    • Emission in general could also be optimised, but I'm more focusing on the reading currently
  • Execution is 2.3us in unsafe mode, and 3.6us in safe mode.
    • Thus Execution is is around 35% slower when using safe mode.
    • Doubt it can be optimised too much more, due to the nature of it being relatively simple, though perhaps a nicer branching system could benefit the code.
  • Reading IR without comments is around 7.2us and with comments is 5.7us
    • The difference can be attributed to the fact that reading without reads the entire line in, and that is less optimised then reading multiple lines, due to the fact it indexes and substrings from that; it also could be attributed to the memory cost associated, and the resulting cache misses.
    • In reality there is little difference, though it does raise questions of whether or not we could improve the compact code, and I think there is a lot of room for improvement there.

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.