Giter Site home page Giter Site logo

hackathon2024's Introduction

Hackathon2024

Please checkout this branch locally:

git clone https://github.com/ThomasDevel/Hackathon2024.git

Open the Hackathon2024.sln solution in the Hackathon2024 folder to get started.

Right click Hackathon2024 solution and go to the properties section. You will be greeted by the Debug and Resources screen, please click on "Open debug launch profiles UI". In the command line arguments box you can place the following:

template.html data.json

Doing so will generate a launchSettings.json for you in the Properties Folder. The first argument corresponds to the desired template you want to render, the second argument is the used dataset. You can leave this settings like this after creating this file.

In this branch you will find 3 projects:

  • Hackathon2024: This contains the implementation for rendering a HTML template according to the Engage Expression style.
  • Hackathon2024.Tests: This contains the unit test to check if the final rendered HTML matches the desired output. The testing is done with xUnit.net. Learn more at https://xunit.net/
  • Hackathon2024.Benchmark: This contains the BenchmarkDotNet code for tracking the performance of the implementation and it provides a reproducible measurement for your experiments. Learn more at https://github.com/dotnet/BenchmarkDotNet

Please make sure you are using Visual Studio 2019 which is necessary for the support of the .NET6.0 SDK.

The goal of this Hackathon

To make our implementation of the TemplateRenderer.cs in Hackathon2024 as fast as possible! We deliberately left a lot of room for improvements in the code and this represents a perfect use case which could occur in a real life enterprise setting.

HTML Templating Whut

Template engines are software that enable you to write HTML code with placeholders, variables, expressions, and logic. For example, you can use a template engine to loop through an array of data and display it in a table, or to conditionally render different elements based on user input. Template engines usually have their own syntax and rules, but they are compatible with standard HTML.

Template engines work by taking a template file, which is a HTML file with some special tags or syntax, and a data object with the values you want to insert into the template. The template engine then parses the template file, replaces the placeholders with the data, and generates a final HTML output that can be sent to the browser. For instance, the example below showcases what a mustache expression looks like and what the expected result should be:

I really love memes. Especially {{meme_of_the_month}}, that one really cracks me up!

Should end up as:

I really love memes. Especially Bobr Kurwa, that one really cracks me up!

Bober

Template engines offer several advantages for web development, such as separating the presentation layer from the data layer, reducing code duplication and boilerplate, and allowing for template reuse across different pages or components.

This example template should finally be rendered as this. Open both html files with your favorite browser to compare them visually.

Benchmark Notes

Make sure you build the Hackathon2024.Benchmark in Release mode instead of Debug and run it by pressing Ctrl+F5 so it does not attach a debugger. Do not worry if this takes a while to complete.

Release

After the run you should be greeted by a similar overview as shown below where you can clearly see that we have an average runtime of 1.785 µs and that our program allocated 5 KB of memory during its runtime. Your job is to get that Mean as low as possible while also taking into account the Allocated memory as much as possible.

Benchmark

But Most Of All

Have a good time, enjoy yourselves and try to learn a thing or two!

Adam

hackathon2024's People

Contributors

grimaceofdespair avatar thomasdevel avatar

Watchers

 avatar

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.