Posting: Ferus is a web engine/browser written in Nim. It aims to be fast, compliant and secure. It doesn't do much yet, it simply does HTML/CSS parsing, it also has an IPC layer written using reliable UDP (netty), a sandboxed rendering model (rendering is not done on the main process), an incomplete DOM implementation and an experimental layout engine is being worked on. All of this is done within 2.1k lines of code. My future plans include:
a rewrite of Bellard's QuickJS in Nim, possibly with JIT compilation
a fully functional layout engine with support for all HTML tags
more speed improvements (particularly in the IPC layer)
full WHATWG compliance
developer tools
builtin adblocker/anti-fingerprinter
embeddable API that abstracts the underlying engine from the main browser itself (like Chromium Embedded Framework or GeckoView)
Manifest V2/V3 support
hardware accelerated video decode
fast 3D graphics (WebGL)
Now, let us talk about Ferus' other component: ferushtml
FerusHTML is a safe, fast and (somewhat) compliant HTML parser that is still being worked on. It uses a finite-state-motion based parser but we intend to add a consume based parser soon. It is somewhat fast, it can parse a simple HTML document within 0.1415580014387766 ms, and it also has a utility for dumping a HTMLElement to show it's children in a neatly organized manner. It doesn't support attributes yet, but that is the top priority as of right now.
Here is the basic API:
import ferushtml
let mySource = """
<html>
<head>
<title>Hello ferushtml!</title>
</head>
<body>
<p1>This is rather plain.</p1>
</body>
</html>
"""
# Create a parser
var myParser = newHTMLParser()
# Parse the HTML source
var res = myParser.parse(mySource)
# Dump the source to stdout in a neat tree like manner
echo res.dump()
Compile the code with --threads:on, and we get this:
You can now time how fast the executable is, or you can check out the benchmark test inside ferushtml tests!
Name: Ferus + FerusHTML
Author: xTrayambak
Posting: Ferus is a web engine/browser written in Nim. It aims to be fast, compliant and secure. It doesn't do much yet, it simply does HTML/CSS parsing, it also has an IPC layer written using reliable UDP (netty), a sandboxed rendering model (rendering is not done on the main process), an incomplete DOM implementation and an experimental layout engine is being worked on. All of this is done within 2.1k lines of code. My future plans include:
Now, let us talk about Ferus' other component: ferushtml FerusHTML is a safe, fast and (somewhat) compliant HTML parser that is still being worked on. It uses a finite-state-motion based parser but we intend to add a consume based parser soon. It is somewhat fast, it can parse a simple HTML document within 0.1415580014387766 ms, and it also has a utility for dumping a HTMLElement to show it's children in a neatly organized manner. It doesn't support attributes yet, but that is the top priority as of right now.
Here is the basic API:
Compile the code with![image](https://github.com/beef331/website/assets/59499552/fab11063-99cd-411e-94ee-9a38269f9694)
--threads:on
, and we get this:You can now time how fast the executable is, or you can check out the benchmark test inside ferushtml tests!
If you are interested in this project, I would appreciate some help at https://github.com/xTrayambak/ferus or https://github.com/xTrayambak/ferushtml.