Coder Social home page Coder Social logo

Comments (8)

dtolnay avatar dtolnay commented on August 15, 2024 2

@gambhiro that doesn't seem like a fair comparison because you are not including any of the other dependencies.

On my computer a build following cargo clean takes 68 seconds without serde_codegen and 115 seconds with serde_codegen, but subsequent builds take 9 seconds either way. When iterating you only care about the 9 second time which is the same for both.

from mdbook.

kbknapp avatar kbknapp commented on August 15, 2024

serde is super nice when used in the nightly branch because you can simply mark your structs as #[derive(Serialize)] or #[derive(Deserialize)] and then encode/decode them to any format supported by serde (I used JSON, but I hear YAML is being worked on too). It worked perfectly!

The downside is you're limited to the nightly branch. serde can be used on stable, but you end up implementing those traits yourself (which isn't too hard, but it is work).

Beyond that, I don't have a lot of knowledge about the differences :\

from mdbook.

azerupi avatar azerupi commented on August 15, 2024

Ok thanks for the clarification!
I will probably wait until all the features are in stable then, and focus on the other things in the meantime.

from mdbook.

gambhiro avatar gambhiro commented on August 15, 2024

Just for reference, this is waiting for rust-lang/rust/issues/29597 and rust-lang/rust/issues/29644 to land in stable.

from mdbook.

azerupi avatar azerupi commented on August 15, 2024

I think it would be OK to make the jump now. Serde is becoming the defacto serialiser / deserialiser even though some ergonomic features are only available on nightly.

I think there are 2 ways we can make it work:

Code gen is obviously more convenient but requires some extra work in the build script. Which is not a big deal.

from mdbook.

gambhiro avatar gambhiro commented on August 15, 2024

I followed the serde readme and made an experiment in this branch, refactoring only bookconfig.rs.

Although it works, the build time has become quite long, 1.5 mins instead of 9 secs.

With codegen:

cargo build  86.78s user 0.57s system 99% cpu 1:27.37 total

while before:

cargo build  8.93s user 0.37s system 99% cpu 9.327 total

I didn't PR because I think it's not worth the long feedback time while working. The feature tickets are apparently being worked on, I suggest waiting until they arrive in the stable release.

from mdbook.

azerupi avatar azerupi commented on August 15, 2024

That is a reasonable choice, thanks for looking into it :)

from mdbook.

gambhiro avatar gambhiro commented on August 15, 2024

@dtolnay Thanks for explaining. I'm quite new to the rust build tools.

from mdbook.

Related Issues (20)

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.