🚀 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 Node.js v16.13.0):

js:   0.11s user 0.02s system 126% cpu 0.102 total
rust: 0.00s user 0.00s system  66% cpu 0.006 total

# tokenize bootstrap-reboot.css               ~45x
js:   tokenizer/small(7K)                  3.063ms
rust: tokenizer/small(7K)                  0.068ms

# tokenize bootstrap.css                      ~26x
js:   tokenizer/fairly_large(201K)        25.672ms
rust: tokenizer/fairly_large(201K)         0.979ms

🎉 Welcome to 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

License

postcss-rs is released under the MIT License. See the LICENSE file in the project root directory for details.

ACKNOWLEDGEMENT

The project is based on the wonderful work of Andrey Sitnik(@ai) 's postcss, which is under MIT License(See HERE), Great thanks to Mr. Sitnik and other contributors' work.

You might also like...
swc is a super-fast compiler written in rust; producing widely-supported javascript from modern standards and typescript.
swc is a super-fast compiler written in rust; producing widely-supported javascript from modern standards and typescript.

Make the web (development) faster. SWC (stands for Speedy Web Compiler) is a super-fast TypeScript / JavaScript compiler written in Rust. It's a libra

Unstable wrapper API for winapi's Console Functions

maulingmonkey-console-winapi-wrappers Unstable wrapper API for winapi's Console Functions Quickstart # Cargo.toml [dependencies] maulingmonkey-console

Ethereal - a general-purpose programming language that is designed to be fast and simple
Ethereal - a general-purpose programming language that is designed to be fast and simple

Ethereal is a general-purpose programming language that is designed to be fast and simple. Heavly inspired by Monkey and written in Rust

 ⚡ Fast Web Security Scanner written in Rust based on Lua Scripts 🌖 🦀
⚡ Fast Web Security Scanner written in Rust based on Lua Scripts 🌖 🦀

⚡ Fast Web Security Scanner written in Rust based on Lua Scripts 🌖 🦀

Fast regex in Rust for Apache Arrow, compiled to WASM

Rust regex in wasm I have been looking for a fast regular expression library in Javascript that runs on Apache Arrow for a few years. Arrow uses UTF-8

ABI encoding, fast

fast-abi Encodes and decodes abi data, fast. Usage const RUST_ENCODER = new FastABI(ABI as MethodAbi[]); const callData = RUST_ENCODER.encodeInput('sa

Node.js bindings to the ripgrep library, for fast file searching in JavaScript without child processes!

ripgrepjs ripgrepjs: Node.js bindings to the ripgrep library, for direct integration with JS programs without spawning an extra subprocess! This proje

🚀 A fast, modern & efficient interpreted language.

Lace is an efficient, modern and predictable procedural programming language written in rust. Easy to write: Lace's syntax is easy to learn and write,

Fast state-of-the-art tokenizers for Ruby

Fast state-of-the-art tokenizers for Ruby

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
🚀 Fast and 100% API compatible postcss replacer, built in Rust
null
A JavaScript Runtime built with Mozilla's SpiderMonkey Engine and Rust

Spiderfire Spiderfire is a javascript runtime built with Mozilla's SpiderMonkey engine and Rust. Spiderfire aims to disrupt the server-side javascript

Redfire 122 Dec 15, 2022
Livny is a modern JavaScript and TypeScript runtime built on top of Rust

Livny is a modern JavaScript and TypeScript runtime built on top of Rust, Golang and the GraalVM Polyglot infrastructure that can run all of Deno and Node.jS applications. It is fine-tuned for user satisfaction, performance and security.

LivnyJS 1 Mar 2, 2022
The official home of the Nyson Programming Language, built off Rust.

Nyson Programming Language The official home of the Nyson Programming Language, built off Rust. (created by Nyelsonon and AMTitan, 2021) Advertisement

Nyson-Programing-Language 19 Aug 10, 2022
WASM-compiled built-in actors used by all Filecoin clients

Built-in Filecoin actors (v8) This repo contains the code for the on-chain built-in actors that power the Filecoin network starting from network versi

Filecoin 45 Jan 4, 2023
STUPID stuffs built by abusing Harfbuzz WASM Shaper.

Harfbuzz-WASM-Fantasy ?? STUPID stuffs built by abusing Harfbuzz WASM Shaper. Bad Apple Maze Game MORE CRAZY STUFFS TO COME SOON! Run with Docker You

hsfzxjy 7 Sep 7, 2023
Robust and Fast tokenizations alignment library for Rust and Python

Robust and Fast tokenizations alignment library for Rust and Python Demo: demo Rust document: docs.rs Blog post: How to calculate the alignment betwee

Explosion 157 Dec 28, 2022
High-level Rust bindings to Perl XS API

Perl XS for Rust High-level Rust bindings to Perl XS API. Example xs! { package Array::Sum; sub sum_array(ctx, array: AV) { array.iter().map(|

Vickenty Fesunov 59 Oct 6, 2022
A minimal library for building compiled Node.js add-ons in Rust via Node-API

A minimal library for building compiled Node.js add-ons in Rust via Node-API

Node-API (N-API) for Rust 3.1k Dec 29, 2022
call rest api using rust + yew

Call Rest API With Rust and Yew: USA Weather Service API Open Data YEW Complete Tutorial YouTube Video https://youtu.be/dSJULWtd3y0 How to run trunk s

Security Union 8 Dec 23, 2022
Rust bindings for writing safe and fast native Node.js modules.

Rust bindings for writing safe and fast native Node.js modules. Getting started Once you have the platform dependencies installed, getting started is

The Neon Project 7k Jan 4, 2023