Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Scope filtering #61

Open
mkeskells opened this issue Mar 28, 2018 · 1 comment
Open

Scope filtering #61

mkeskells opened this issue Mar 28, 2018 · 1 comment
Assignees

Comments

@mkeskells
Copy link
Collaborator

  override def filterNot(p: Symbol => Boolean): Scope = (
      if (toList exists p) newScopeWith(toList filterNot p: _*)
      else this
    )
    override def filter(p: Symbol => Boolean): Scope = (
      if (toList forall p) this
      else newScopeWith(toList filter p: _*)
    )

may iterate the list twice, and perform functions of known results (those previously examined)

note - toList is already cached

@ackratos
Copy link
Collaborator

do you mean we should:

override def filter(p: Symbol => Boolean): Scope = (
      val filtered = toList filter p
      if (filtered.size == toList.size) this
      else newScopeWith(filtered: _*)
)

If this looks good, I'd like take this one to play with latest perf_tester.

@dskells dskells self-assigned this Mar 31, 2018
pkukielka pushed a commit that referenced this issue Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants