Coder Social home page Coder Social logo

codealike / arrayslice Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 4.0 308 KB

ArraySlice allows to build shared memory array views without performance impact. It uses IL manipulation to achieve the fastest implementation.

License: MIT License

C# 97.16% PowerShell 2.84%

arrayslice's People

Contributors

redknightlois avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arrayslice's Issues

Unsafe optimizations

The implementation of unsafe optimization implies accessing fields on first use, create the local variables and let the optimization method to do its work.

Allowing the use of fields while unsafe in the general case (because of multithreading) should be allowed via the use of an attribute.

Running PeVerify produces error

Running PEverify on the output of this https://github.com/Fody/FodyAddinSamples/tree/master/ArraySlicesSample

Results in

Error   4   Fody: PEVerify of the assembly failed.

Microsoft (R) .NET Framework PE Verifier.  Version  4.0.30319.33440
Copyright (c) Microsoft Corporation.  All rights reserved.

[IL]: Error: [C:\Code\Fody\FodyAddinSamples\ArraySlicesSample\bin\Debug\ArraySlicesSample.dll : AsyncErrorHandlerSample::Run][offset 0x0000005A] Unable to resolve token.
1 Error(s) Verifying C:\Code\Fody\FodyAddinSamples\ArraySlicesSample\bin\Debug\ArraySlicesSample.dll
    ArraySlicesSample

Do not optimize when there is no performance net win

Sometimes optimization will introduce more instructions (preparation phase) than the ones than the times accessors are used, therefore penalizing on performance.

Examples like:

  • Single getter or setter.
  • Non loops accesses.
  • Small loops (up to 4 loops in general)

ArraySlice should be able to find that out, and do not optimize the method is there is no net win in performance.

Optimization for the general case of Offset == 0

This optimization will allow to optimize for the case where offsets start at 0 and therefore it wont be necesarry to add the offset to the stack.

The proper way to handle this is duplicating the method code and have 2 MSIL paths. One that will handle the (Offset == 0) condition and another one that will handle the (Offset != 0) condition. The concept itself is more or less the same used at optimizing compilers to handle Loop Unrolling.

Update to Fody Version 2

Fody Version 2 is out and you will need to do an update for your addin to be usable with it

Specifically:

  • Update to the newest Fody.Cecil nuget
  • Change the min dependency ranged for Fody to be at least 2.0

Please ping me if u need help

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.