servo / servo/rust-cssparser

Do not generate colors phf map at compile time

Open
#236 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Rust
Stars
869
Forks
152
Avg merge
15h 8m
Merged PRs (30d)
12

Description

phf_codegen is a pretty big dependency and colors will not change from build to build, so maybe it's better to keep the colors map as a "prebuilt" file? Something like this.

The source of the problem:

cssparser v0.24.1 (./rust-cssparser-0.24.1)                                         
├── cssparser-macros v0.3.4 (./rust-cssparser-0.24.1/macros)
│   ├── phf_codegen v0.7.24
│   │   ├── phf_generator v0.7.24
│   │   │   ├── phf_shared v0.7.24
│   │   │   │   └── siphasher v0.2.3
│   │   │   └── rand v0.6.5
│   │   │       ├── libc v0.2.48
│   │   │       ├── rand_chacha v0.1.1
│   │   │       │   └── rand_core v0.3.1
│   │   │       │       └── rand_core v0.4.0
│   │   │       │   [build-dependencies]
│   │   │       │   └── autocfg v0.1.2
│   │   │       ├── rand_core v0.4.0 (*)
│   │   │       ├── rand_hc v0.1.0
│   │   │       │   └── rand_core v0.3.1 (*)
│   │   │       ├── rand_isaac v0.1.1
│   │   │       │   └── rand_core v0.3.1 (*)
│   │   │       ├── rand_jitter v0.1.3
│   │   │       │   └── rand_core v0.4.0 (*)
│   │   │       ├── rand_os v0.1.2
│   │   │       │   ├── libc v0.2.48 (*)
│   │   │       │   └── rand_core v0.4.0 (*)
│   │   │       ├── rand_pcg v0.1.1
│   │   │       │   └── rand_core v0.3.1 (*)
│   │   │       │   [build-dependencies]
│   │   │       │   └── rustc_version v0.2.3
│   │   │       │       └── semver v0.9.0
│   │   │       │           └── semver-parser v0.7.0
│   │   │       └── rand_xorshift v0.1.1
│   │   │           └── rand_core v0.3.1 (*)
│   │   │       [build-dependencies]
│   │   │       └── autocfg v0.1.2 (*)
│   │   └── phf_shared v0.7.24 (*)

It's like 20 dependencies just to build a phf map, that never changes.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the colors map generation in the cssparser-macros code and compare the proposed prebuilt-file approach with the linked svgtypes colors.rs. Check the dependency tree before and after; done means the colors map is kept in source form without requiring phf_codegen and its generator dependencies at compile time.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.