Skip to content

add a section on performance to collection docs #21217

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 23, 2015
Merged

Conversation

Gankra
Copy link
Contributor

@Gankra Gankra commented Jan 16, 2015

Not sure on what exactly should be said here, but I think this is the most important bit. This PR also establishes conventions for describing performance minimally.

I suggest to describe preformance for individual methods we use a # Performance heading. Not sure if we should have

# Performance: O(1)
details details

or

# Performance:
O(1)
details details

Since I think most methods don't need discussion, the former seems more resonable. But it's kind of weird to have info "in" the heading.

r? @steveklabnik

@Gankra
Copy link
Contributor Author

Gankra commented Jan 16, 2015

I guess another open question is if O(1)* notation can be used freely throughout the docs, or if amortized or amort. should be used elsewhere.

@Gankra
Copy link
Contributor Author

Gankra commented Jan 16, 2015

Also there's I guess a choice of *O(1) vs O*(1) vs O(1)*

//! important operations. For further details, see each type's documentation.
//!
//! Throughout the documentation, we will follow a few conventions. For all operations,
//! the collection's size is denoted by n. If another collection is involved in the operation, it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably have graves around the 'n'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I wasn't sure about this. Ideally I would use mathmode, but we don't support it. Making all the math codemode is a bit weird looking.

  • O(min(i, n-i))
  • O(min(i, n-i))
  • O(min(i, n-i))
  • O(min(i, n-i))

@steveklabnik
Copy link
Member

I like it.

@steveklabnik
Copy link
Member

@bors: r+ 3819c22 rollup

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jan 22, 2015
Not sure on what *exactly* should be said here, but I think this is the most important bit. This PR also establishes conventions for describing performance minimally.

I suggest to describe preformance for individual methods we use a `# Performance` heading. Not sure if we should have 

```
# Performance: O(1)
details details
```
or

```
# Performance:
O(1)
details details
```

Since I think most methods don't need discussion, the former seems more resonable. But it's kind of weird to have info "in" the heading.

r? @steveklabnik
bors added a commit that referenced this pull request Jan 23, 2015
@bors bors merged commit 3819c22 into rust-lang:master Jan 23, 2015
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants