🚀 Fast and 100% API compatible postcss replacer, built in Rust

Overview

postcss-rs

🚀 Fast and 100% API compatible postcss replacer, built in Rust

⚠️ DO NOT USE. STILL WORK IN PROGRESS.

Performance Improvement

Tokenize bootstrap.css (Compare with postcss.js):

rust: 0.00s user 0.00s system  71% cpu 0.007 total
js:   0.13s user 0.02s system 126% cpu 0.109 total

# tokenize bootstrap-reboot.css ~18x
js:   tokenizer/small(7K)       : 2.274ms
rust: tokenizer/small(7K)       : 0.120ms

# tokenize bootstrap.css ~14x
js:   tokenizer/small(201K)     : 31.367ms
rust: tokenizer/small(201K)     :  2.158ms

🎉 Welcome contribute, here is a guide:

git checkout main
cargo bench -- --save-baseline main

Create a baseline, Then do some optimization work here.

git checkout feature  ## `feature` is your branch 

Compare against the main baseline.

cargo bench -- --baseline main
You might also like...
A simple, fast and fully-typed JSPaste API wrapper for Rust

rspaste A simple, fast and fully-typed JSPaste API wrapper for Rust. aidak.tk » Installation Put the desired version of the crate into the dependencie

API wrapper for the tankerkönig api

tankerkoenig-rs API wrapper for the tankerkoenig-api written in rust. Gives you ready deserialized structs and a easy to use and strictly typed api. I

A repository full of manually generated hand curated JSON files, which contain the API Types that the Discord API returns.

Discord API Types A repository full of manually generated hand curated JSON files, which contain the API Types that the Discord API returns. Also did

🦜 A hassle-free, highly performant, host it yourself Discord music bot built with Serenity in Rust. Powered by youtube-dl and Genius.

🦜 A hassle-free, highly performant and fast evolving Discord music bot built with Serenity in Rust. Deployment Usage Just create a bot account, copy

A job queue built on sqlx and PostgreSQL.

sqlxmq A job queue built on sqlx and PostgreSQL. This library allows a CRUD application to run background jobs without complicating its deployment. Th

Announce blogs and send emails. Originally built for ConnectDome.
Announce blogs and send emails. Originally built for ConnectDome.

ConnectDome - Rust Notify A simple service to announce new blogs on your Slack/Discord + send emails to your list via your TES. Feature 1: Posts blogs

A better message queue built by rust

bettermq A better message queue built by rust I start this project to study Rust

Risc-V assembly interpreter built with pure Rust
Risc-V assembly interpreter built with pure Rust

Risc-V Interpreter Interpreter for Risc-V assembly built with Rust Report bug · Request feature Table of contents Quick start Exemple Program Instruct

Shows my Spotify status on a small screen. Powered by ESP-IDF & built with 🧡 in Rust! 🦀
Shows my Spotify status on a small screen. Powered by ESP-IDF & built with 🧡 in Rust! 🦀

ESP Display A small embedded project that shows what I'm listening to on Spotify by using my Spotify service. Example Notable Features ESP32-S3 board

Comments
  • perf: :zap: :zap: :zap: remove buffer

    perf: :zap: :zap: :zap: remove buffer

    CAUTION: PERFORMANCE SUPERCHARGED! :zap: :zap: :zap:

    Not really sure what's goin' on, but tests all passed, who knows

    image

    DO NOT MERGE THIS! WAIT UNTIL PARSER TESTS ALL PASSED!

    Signed-off-by: CGQAQ [email protected]

    opened by CGQAQ 4
  • Perf/tokenizer

    Perf/tokenizer

    main branch

    Gnuplot not found, using plotters backend
    small css file 7K       time:   [603.07 us 620.45 us 639.07 us]                              
    Found 1 outliers among 100 measurements (1.00%)
      1 (1.00%) high severe
    
    large css file 201K     time:   [13.683 ms 13.894 ms 14.094 ms]                                
    Found 15 outliers among 100 measurements (15.00%)
      15 (15.00%) low mild
    

    current branch

    small css file 7K       time:   [149.54 us 164.43 us 181.72 us]                              
                            change: [-80.187% -76.213% -72.627%] (p = 0.00 < 0.05)
                            Performance has improved.
    Found 14 outliers among 100 measurements (14.00%)
      2 (2.00%) high mild
      12 (12.00%) high severe
    
    large css file 201K     time:   [9.1747 ms 9.4870 ms 9.8056 ms]                                
                            change: [-34.236% -31.719% -28.996%] (p = 0.00 < 0.05)
                            Performance has improved.
    
    
    opened by IWANABETHATGUY 1
  • Current status of this project

    Current status of this project

    Hi, I thought about a rust implementation of postCSS for quite some time and I'm glad this attempt exists. I am a beginner in Rust and while I was able to put together a basic parser using nom, I recon when it comes to visiting and changing the AST I do lack lot of experience with some Rust idiomatic patterns and especially memory management...

    I still would like to learn more of the language and I see this project is definitely one I'd like to keep an eye on and eventually contribute to, I do maintain a CSS framework based on postcss-modules and on the long term I'd love to migrate it to rust to make it faster.

    I opened this ticket to try and get an overview of the status of the project and how to best contribute.

    1. Is the project currently actively developed? Is there a tentative roadmap or list of known issues/tasks beside the missing plugins?
    2. Would be great to have a contributing guide, a basic description of the architecture and especially a guide to write plugins that may be the most approachable area for external contributors
    3. I am also curious about the plugin API in general, in my mind I envisioned both a Rust API with some Plugin trait with a stable API, as well as maybe a way to use WASM compiled plugins as that may open the door to a larger community and possibly better integration with JS based pipelines (even though most likely lower speed). I wonder if this is something that was discussed and what are your thoughts about it
    opened by axyz 5
  • perf: ⚡️ 20% perf

    perf: ⚡️ 20% perf

    this branch

    Gnuplot not found, using plotters backend
    recursive_parser/small(7K)                                                                            
                            time:   [42.298 us 42.547 us 42.754 us]
                            change: [-20.656% -19.481% -18.441%] (p = 0.00 < 0.05)
                            Performance has improved.
    Found 11 outliers among 100 measurements (11.00%)
      11 (11.00%) low mild
    
    Benchmarking recursive_parser/large(201K): Warming up for 3.0000 s
    Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.2s, enable flat sampling, or reduce sample count to 50.
    recursive_parser/large(201K)                                                                             
                            time:   [1.0933 ms 1.1002 ms 1.1058 ms]
                            change: [-19.383% -17.867% -16.332%] (p = 0.00 < 0.05)
                            Performance has improved.
    
    

    main branch

    recursive_parser/small(7K)                                                                            
                            time:   [51.944 us 52.056 us 52.149 us]
                            change: [+21.004% +22.630% +24.207%] (p = 0.00 < 0.05)
                            Performance has regressed.
    Found 11 outliers among 100 measurements (11.00%)
      10 (10.00%) low severe
      1 (1.00%) low mild
    
    Benchmarking recursive_parser/large(201K): Warming up for 3.0000 s
    Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 8.3s, enable flat sampling, or reduce sample count to 50.
    recursive_parser/large(201K)                                                                             
                            time:   [1.3027 ms 1.3081 ms 1.3125 ms]
                            change: [+18.758% +20.880% +23.165%] (p = 0.00 < 0.05)
                            Performance has regressed.
    Found 9 outliers among 100 measurements (9.00%)
    
    opened by IWANABETHATGUY 2
Owner
迷渡
Creator of vscode-deno. Currently a contributor to Deno @denoland.
迷渡
Efficent platform for inference and serving local LLMs including an OpenAI compatible API server.

candle-vllm Efficient platform for inference and serving local LLMs including an OpenAI compatible API server. Features OpenAI compatible API server p

Eric Buehler 21 Nov 15, 2023
This is a 100% Rust bootloader for the nRF9160 microcontroller written for Dutch IoT Solutions

nRF9160 Bootloader for Dutch IoT Solutions This is a 100% Rust bootloader for the nRF9160 microcontroller written for Dutch IoT Solutions. Currently,

Tweede golf 4 Jul 14, 2022
Write Cloudflare Workers in 100% Rust via WebAssembly. (A fork of workers-rs)

Note: This is a fork to workers-rs. Work-in-progress ergonomic Rust bindings to Cloudflare Workers environment. Write your entire worker in Rust! Read

Abid Omar 7 Jan 11, 2023
OpenAI compatible API for serving LLAMA-2 model

Cria - Local llama OpenAI-compatible API The objective is to serve a local llama-2 model by mimicking an OpenAI API service. The llama2 model runs on

AmineDiro 66 Aug 8, 2023
Blazingly fast spam classification API built using Rocket Web Framework.

Telegram Antispam API Blazingly fast spam classification API built using Rocket Web Framework. Notes The classifier works in aggressive mode, it can s

Akshay Rajput 13 May 5, 2023
A rust library for interacting with multiple Discord.com-compatible APIs and Gateways at the same time.

Chorus A rust library for interacting with (multiple) Spacebar-compatible APIs and Gateways (at the same time). Explore the docs » Report Bug · Reques

polyphony 4 Apr 30, 2023
A Litecord compatible/inspired OSS implementation of Discord's backend for fun and profit.

A Litecord compatible/inspired OSS implementation of Discord's backend for fun and profit.

Evie Viau 3 May 9, 2022
Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs

Alternative implementation of the Bitwarden server API written in Rust and compatible with upstream Bitwarden clients*, perfect for self-hosted deploy

Daniel García 21.5k Jan 8, 2023
Emerald, the EVM compatible paratime

The Emerald ParaTime This is the Emerald ParaTime, an official EVM-compatible Oasis Protocol Foundation's ParaTime for the Oasis Network built using t

Oasis Protocol Foundation 5 Mar 31, 2022
Modrinth API is a simple library for using, you guessed it, the Modrinth API in Rust projects

Modrinth API is a simple library for using, you guessed it, the Modrinth API in Rust projects. It uses reqwest as its HTTP(S) client and deserialises responses to typed structs using serde.

null 21 Jan 1, 2023