Skip to content

Test opt-level not behaving as expected #106

Closed
@giarc3

Description

@giarc3

In ironoxide, we currently have 3 profile sections: [profile.dev], [profile.test], and [profile.release]. We have changed the default opt-level for dev and test to be 2.
I would advocate for setting dev back to 0 in order to allow for fast compilation by RLS while writing new code.

The problem with this is that I believe that [profile.test] is not working as documented. It appears that tests takes the optimization from [profile.dev] instead.

Running time cargo t after already compiling with cargo t --no-run, I get the following:

dev opt-level test opt-level test time
2 2 25s
0 2 90s

This suggests that test's opt-level is not respected.

I have seen threads (from years ago) where people suggest that [profile.test] and [profile.bench] be deprecated, as they argue that it should simply inherit from [profile.dev] and [profile.release], respectively, but I haven't seen mention of that happening, and the current docs still mention those sections.

In spite of all this, I would suggest the following:

  • Set dev's opt-level to its default (0)
  • Remove the [profile.test] section as I find it misleading
  • Use cargo t for general testing, and cargo t --release when speed is a factor

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions