The results of the summer Hola JS programming contest

    Thanks to everyone who participated in our programming contest ! We summed up its results and awarded the winners.

    The objective was to improve the implementation of the doubly linked list from the source code of Node.js. This code is fast and efficient, but it was written for a specific application - storing lists of inactive timers. Therefore, the idleNext and idlePrev fields are added directly to the stored objects. The contestants were faced with the task of making the code universal (so that one element could belong to several independent lists at the same time) without loss of performance.

    The obvious solution is to add intermediate objects - list links - containing the next, prev, and value fields. But this approach has a serious drawback: if we only have a link to the stored object and we need to remove it from the list, then we will have to sort through the whole chain. There is a loss of performance.

    We rated higher solutions where instead of idleNext and idlePrev fields a pair of fields with different names different in different lists is used. However, when accessing the members of objects using the “square brackets” operator instead of the “period”, the V8 compiler cannot perform important optimizations, so the code works more slowly.

    Prizes were awarded to those participants who used a self-modifying code. If we replace idleNext and idlePrev with other names in the implementation of the list, and then force the interpreter to execute the resulting code (using the dot operator), performance does not drop.

    Details about how and for which we awarded points to the participants, as well as all the decisions we received, are in the repository on GitHub . Congratulations to the winners!

    1. Sergey Shpak - prize 1500 USD
    2. Ori Shalev - prize 1000 USD
    3. Alexander Lyakshev - a prize of 500 USD

    Separately, we decided to mark the youngest participants - one of them is 12, and the other is 15 years old. Their team took seventh place. Dmitry and Ruslan received a special prize - 350 USD.

    We are already thinking about the task for the next competition.

    Also popular now: