Git Product home page Git Product logo

astl's Introduction

Hits Facebook Instagram LinkedIn Dev.to

trophy

Github Stats

Architect C++ TypeScript

03_Linkedin Cover

I have studied programming for 25 years since 1998. During that time, I developed many programs and had many opportunities to improve my skills dramatically. So I confidently say, "I am one of the best programmers in my country, Korea."

I also develop open source projects. When developing a program, I develop open-source components in my spare time when I feel that I need new features or that the usual features are not good enough. If these leisure developments are cumulative and follow a single paradigm or pattern, they will be re-created as new open-source projects, as seen below.

astl's People

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

astl's Issues

Implement containers and iterators first

As I'm a typical newbie of the AssemblyScript, I don't know whether which features are possible and which statements are not possible. Therefore, to study and be familiar with the AssemblyScript, I will implement containers and iterators first. Like TSTL, those containers would be implemented.

Linear Containers

  • Vector
  • List
  • Deque
  • ForwardList
  • VectorBoolean

Associative Containers

Map Containers

  • HashMap
  • HashMultiMap
  • TreeMap
  • TreeMultiMap

Set Containers

  • HashSet
  • HashMultiSet
  • TreeSet
  • TreeMultiSet

Experimental Containers

  • experimental.FlexMap
  • experimental.FlexMultiMap
  • experimental.FlexSet
  • experimental.FlexMultiSet

Adaptor Containers

  • Stack
  • Queue
  • PriorityQueue

Improve performance of HashBuckets using native tuing

Outline

Set Containers

Method HashSet LightSet Set
insert 223 ms 207 ms 35 ms
has 563 ms 555 ms 307 ms
iteration 4 ms 32 ms 17 ms
erase 114 ms 96 ms 36 ms

Map Containers

Method HashMap LightMap Map
insert 282 ms 229 ms 37 ms
has 611 ms 587 ms 319 ms
iteration 16 ms 36 ms 17 ms
erase 123 ms 102 ms 35 ms

Comparing elapsed time with my ASTL hash containers vs. AssemblyScript native hash containers, the AssemblyScript native hash containers are faster than of mine. Although my ASTL hash containers are based on the doubly-linked-list to providing much more features than the AssemblyScript, there're two things that can adapt from the AssemblyScript to enhance the performance.

Performance tuning

The first way is to using not the mod (%) operator but the bitwise and (&) operator in the hash buckets. If size of the hash buckets always be multiple of 2, the ^ operation can replace the % operation and it may lead my ASTL container to be about two times faster.

Modulo and Division vs Bitwise Operations

https://mziccard.me/2015/05/08/modulo-and-division-vs-bitwise-operations/

The second way is to using the manual management system of the AssemblyScript. With the @unmanaged tag who can deny automated memory management by the garbage collector like the AssemblyScript's implementation code, the performance would be enough enhanced like the AssemblyScript.

assemlyscript/std/Map.ts

https://github.com/AssemblyScript/assemblyscript/blob/master/std/assembly/map.ts

Add comparators to the array based iterators

  • Vector.Iterator<T>.operatr<()
  • Vector.Iterator<T>.operatr<=()
  • Vector.Iterator<T>.operatr>()
  • Vector.Iterator<T>.operatr>=()
  • Deque.Iterator<T>.operatr<()
  • Deque.Iterator<T>.operatr<=()
  • Deque.Iterator<T>.operatr>()
  • Deque.Iterator<T>.operatr>=()
  • MapElementVector.Iterator<Key, T>.operatr<()
  • MapElementVector.Iterator<Key, T>.operatr<=()
  • MapElementVector.Iterator<Key, T>.operatr>()
  • MapElementVector.Iterator<Key, T>.operatr>=()

Consider limitations of the AssemblyScript

The AssemblyScript doesn't support those features yet:

  • Type conjuction and disjunction
    • Therefore, it's not possible to extending the multiple interfaces
  • In the closure function, capturing variables from the outside of the function scope is not possible.
  • When generic extensions are composite, the compiler falls into the stack overflow
  • Virtual method is not implemented yet
    • Therefore, abstract class is vulnerable

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.